Attention: The Marketo Community will undergo scheduled maintenance on Tuesday, August 20th between 10-11 PM PDT. During this time, the Community and its content will not be accessible. We apologize for any inconvenience this may cause.
Are you in Sydney?
Yes.
K, just checking first! I'm on my phone so can't verify the rest. Let me respond later or tomw. I suspect (well, know) that the stored value has a different offset than what's displayed in SFDC, so you have to account for that.
Hi Sanford Whiteman I'm looking to create an email velocity script that will display the stored date/time field in the U.S. pacific time zone.
Marketo support says date time field tokens populate with Central time regardless of the location the Marketo Instance is set. This is due to how field values are stored in Marketo.
Would I be able to follow the format of the solution you've provided and swap out any Australia/Sydney reference to US/Pacific? Thank you!
This is due to how field values are stored in Marketo.
(It's actually not because of the way they're stored, but the behavior is known in any case.)
Would I be able to follow the format of the solution you've provided and swap out any Australia/Sydney reference to US/Pacific? Thank you!
Yes, the time zone name is
America/Los_Angeles
Thank you Sanford Whiteman for the quick response!
This is the velocity script I'm now testing - the particular lead I'm previewing the email at has a create at date/time of Jan 8, 2019 10:22 AM. The velocity script is returning the value as Jan 8, 2019 12:22:00. What did I do wrong?
#set( $inTimeZone = $date.getTimeZone().getTimeZone('America/Los_Angeles') )
#set( $outTimeZone = $date.getTimeZone().getTimeZone('America/Los_Angeles') )
#set( $locale = $date.getLocale() )
#set( $myDate = $convert.parseDate(${lead.Created_At},'yyyy-MM-dd HH:mm:ss',$locale,$inTimeZone) )
${date.format('yyyy-MM-dd HH:mm:ss',$myDate,$locale,$outTimeZone)}
Can I ask that you go back and highlight the code using the Advanced Editor's syntax highlighter? That makes it readable.
Also please take the curly braces out from ${lead.Created_At}. Use the simple notation $lead.Created_At. That isn't causing the problem but can cause other problems down the line.
When you simply print the String
$lead.Created_At
in Velocity, do you see
2019-01-08 10:22:00
?
#set( $inTimeZone = $date.getTimeZone().getTimeZone('America/Los_Angeles') )
#set( $outTimeZone = $date.getTimeZone().getTimeZone('America/Los_Angeles') )
#set( $locale = $date.getLocale() )
#set( $myDate = $convert.parseDate($lead.Created_At,'yyyy-MM-dd HH:mm:ss',$locale,$inTimeZone) )
${date.format('yyyy-MM-dd HH:mm:ss',$myDate,$locale,$outTimeZone)}
If I simply print the string
$lead.Created_At
In velocity I see
2019-01-08 12:22:00
Sorry, the $inTimeZone should be America/Chicago, the $outTimeZone America/Los_Angeles.
Thank you it worked beautifully! Curious to your point about removing the {brackets} surrounding the fields. Why would it cause problems in the velocity script? We have that in place for all of our script and want to make sure they continue to function properly.