CustomObject datetime output off by 2 hours
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:
- 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?
Thanks for any help you can provide.