SOLVED

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

Go to solution
megsie_k
Level 2

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}}.

megsie_k_0-1662337449009.png

 

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:

megsie_k_1-1662338434099.png

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:

megsie_k_2-1662339126057.png

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!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

Date format symbols aren't positional. They're case-sensitive. Capital M is month, lowercase m is minute. Capital H is 24-hour hour.

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

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

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_k
Level 2

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

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
Level 10 - Community Moderator

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


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

Thanks, nice to hear!