AnsweredAssumed Answered

Velocity and Date Tokens

Question asked by 7c2da499e7a63f42d68614eb70394a5aaa39150e on Nov 27, 2014
Latest reply on Nov 29, 2014 by Brennan McAdams
Hi Nation!

We are working on a velocity script to make a date formatted in a more natural language like "We will expect you on December 13". Unfortunatelly, when I try to use the line 
#set( $mydate = ${convert.parseDate(${lead.mydatetoken},"YYYY-MM-dd")})
The variable $mydate is empty. I realized this has to do with the fact the string is not always YYYY-MM-dd, it can change. I still haven't figured out why, I believe it has to do with the fact that our users have different locales.

My question is... is there a way to get from the actual lead token, in this case ${lead.mydatetoken}, a definitive value regardless of locale? just as you would in other programming languages where you would get a long counting the seconds from midnight January 1st 1970? 

Any help will be very appreciated, thanks!

Outcomes