Re: Issue with Time Display in Email Velocity Script

SanfordWhiteman
Level 10 - Community Moderator

Re: Issue with Time Display in Email Velocity Script

I need to see the raw value of ${lead.apptBookedTime} for this same lead, in the same context (simply add that line to the end of the script, after a <br> to make it readable).

Also please use the syntax highlighter when pasting code.

Anonymous
Not applicable

Re: Issue with Time Display in Email Velocity Script

In addition to the above, if I simply input ${lead.apptBookedTime}

Output is:

Screen Shot 2018-02-14 at 4.30.15 pm.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Issue with Time Display in Email Velocity Script

Appointment time: 2018-02-12 23:00:00

OK, so we're back to the format

"yyyy-MM-dd HH:mm:ss"

You can't parse a string as

"yyyy-MM-dd'T'HH:mm"

If it doesn't actually have the T character!

In addition, if it's coming out as 11:00am the day before, it's clear that this data is being output in something other than Australia/Sydney (your pod time and instance time are not the same). It looks like US Central time, the common pod time.

So you want:

#set( $inTimeZone = $date.getTimeZone().getTimeZone('America/Chicago') )

#set( $outTimeZone = $date.getTimeZone().getTimeZone('America/Sydney') )

#set( $locale = $date.getLocale() )

#set( $myDate = $convert.parseDate(${lead.apptBookedTime},"yyyy-MM-dd HH:mm",$locale,$inTimeZone) )

${date.format('hh:mm a',$myDate,$locale,$outTimeZone)}

Anonymous
Not applicable

Re: Issue with Time Display in Email Velocity Script

I see what you mean. It looks like that worked .

Screen Shot 2018-02-14 at 4.46.59 pm.png

Amazing, thanks so much for your help!

SanfordWhiteman
Level 10 - Community Moderator

Re: Issue with Time Display in Email Velocity Script

Sure, glad it's working.

Kelci_Martinsen
Level 2

Re: Issue with Time Display in Email Velocity Script

This entire thread was super helpful for troubleshooting an issue I've been having (in addition to your blog post --> https://blog.teknkl.com/velocity-days-and-weeks/#notes) Thank you so much!