OK, I've been reading through all of the material on these posts, but I seem to be missing one piece. Context: we created a custom object for appointments, and one of the fields is appointment date, which is of type datetime. In the REST API calls, we post the appointment date in the following format:
Cool, all good. Now I've created a campaign triggered on an appointment add. All good there. I created a token for the date and time, and here's the time token definition:
#set( $dateOptions = {
"formats" : {
"userin" : "yyyy-MM-dd HH:mm:ss",
"userout" : "hh:mm a z"
},
"timezones" : {
"userin" : "America/Los_Angeles",
"userout" : "America/Los_Angeles"
},
"locale" : $date.getLocale()
} )
#set( $appointmentDatelike = $TriggerObject.appointmentDateTime )
#set( $appointmentDate = $convert.parseDate(
$appointmentDatelike,
$dateOptions.formats.userin,
$dateOptions.locale,
$date.getTimeZone().getTimeZone($dateOptions.timezones.userin)
) )
#set( $appointmentDate_formatted = $date.format(
$dateOptions.formats.userout,
$appointmentDate,
$dateOptions.locale,
$date.getTimeZone().getTimeZone($dateOptions.timezones.userout)
) )
${appointmentDate_formatted}
Two questions:
Thanks for any help you can provide.
Solved! Go to Solution.
Two questions:
- I was surprised that the userin format only worked with "yyyy-MM-dd HH:mm:ss" when it technically should be "yyyy-MM-dd'T'HH:mm:ssZ". Why would this be the case, or am I mistaken?
- The output date that is being sent is coming back with 2:00 pm PT. Given the example, I'm struggling to understand why this is the case. Can someone provide some insight on this?
Two questions:
- I was surprised that the userin format only worked with "yyyy-MM-dd HH:mm:ss" when it technically should be "yyyy-MM-dd'T'HH:mm:ssZ". Why would this be the case, or am I mistaken?
- The output date that is being sent is coming back with 2:00 pm PT. Given the example, I'm struggling to understand why this is the case. Can someone provide some insight on this?
Thank you @SanfordWhiteman, that was the piece I was missing. Do you mind telling me where you knew that? I clearly missed the documentation from Marketo that notes this. Appreciate your quick response - it helps me a ton!
Jon
There’s scant official documentation, which is why most Marketo-Velocity devs read my blog posts. 🙂
Hahaha - just discovered your blog. Thank you for the sheer volume of time you must put into this. Appreciate it!