Skip to main content
Level 2
Sep 5, 2022 1:01 AM UTC
Solved

Velocity Date Time Script for Email / Alert with From Submission Time

Hi All, 

 

I am having an issue getting the form submission date/time to show in the correct timezone. I have read through various posts and blogs but can't seem to get this to work.

 

The set-up:

The instance and account timezone is (GMT+10:00) Australian Eastern Standard Time (Australia/Sydney) (AEST).

 

I have a custom field called Last Marketo Form Submission, when the Global form is filled there is a flow step to change the data value to {{system.dateTime}}.

 

I have a global folder level email script token called {{my.date}}, which filters down to my program, with the following code:

 

 

#set( $inTimeZone = $date.getTimeZone().getTimeZone('Australia/Sydney') ) #set( $outTimeZone = $date.getTimeZone().getTimeZone('Australia/Sydney') ) #set( $locale = $date.getLocale() ) #set( $myDate = $convert.parseDate($lead.lastMarketoFormSubmission,'yyyy-mm-dd hh:mm:ss',$locale,$inTimeZone) ) ${date.format('dd-mm-yyyy hh:mm a z',$myDate,$locale,$outTimeZone)}

 

 

 

I have an email alert with the {{my.date}} field. 

 

Testing:

My form is embedded on a WordPress page, I submit the form and can see the customer's Last Marketo Form Submission shows as:

What I see in the activity log: 2022-09-04 19:19:34.

 

When I view the email alert it shows as Submission Date/Time: 04-19-2022 07:19 PM AEDT

 

What I expect to see is: 05-09-2022 10:19 AM AEST

 

What I have tried to fix this:

I thought that the Marketo pod-wide timezone causes this issue, so I tried changing the email script to intimezone:

 

 

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

 

 

 

But this also didn't work.

I can see the Last Marketo Form Submission shows:

What I see in the activity log: 2022-09-04 19:49:32

 

What shows in the email: 05-49-2022 12:49 PM AEDT

 

What I expect to see: 05-09-2022 10:49 AM AEST.

 

Any help in resolving this would be greatly appreciated!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Sep 5, 2022 1:38 AM UTC
Date format symbols aren't positional. They're case-sensitive. Capital M is month, lowercase m is minute. Capital H is 24-hour hour.

3 replies

SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Sep 5, 2022 1:38 AM UTC
Date format symbols aren't positional. They're case-sensitive. Capital M is month, lowercase m is minute. Capital H is 24-hour hour.
Translate
megsie_kAuthor
Level 2
Sep 6, 2022 2:16 AM UTC

Hi Sanford, 

 

Thanks so much, I can't believe I overlooked that. 

 

Appreciate your help and all your contributions here and on your blog!

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Sep 6, 2022 3:14 AM UTC

Appreciate your help and all your contributions here and on your blog!

Thanks, nice to hear!

Translate