Velocity Date Time Script for Email / Alert with From Submission Time | Community
Skip to main content
New Participant
September 5, 2022
Solved

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

  • September 5, 2022
  • 1 reply
  • 2118 views

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.
Best answer by SanfordWhiteman
Date format symbols aren't positional. They're case-sensitive. Capital M is month, lowercase m is minute. Capital H is 24-hour hour.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
September 5, 2022
Date format symbols aren't positional. They're case-sensitive. Capital M is month, lowercase m is minute. Capital H is 24-hour hour.
megsie_kAuthor
New Participant
September 6, 2022

Hi Sanford, 

 

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

 

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

SanfordWhiteman
New Participant
September 6, 2022

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

Thanks, nice to hear!