I would like a tip, please :
To convert a String to Date in velocity:
It is $convert.parseDate($currentMessage.date.begin)
I try too :
#set($str = $!currentMessage.date.begin)
$str
#set($dateTransforme = $date.toDate('yyyy-MM-dd', $date.date))
$dateTransforme
$dateTransforme.parseDate($str) <br />
N.B. $currentMessage.date.begin is a string.
I continue to have at the running :
$dateTransforme.parseDate($str)
Why? My string is in the format '2014-02-26'
Thanks,
Here is the working code with datetool
#set ($toDateRegDate= $dateTool.toDate('yyyy-MM-dd hh:mm:ss Z', $Video.Date.getData()))
#set ($videoDate = $dateTool.format('MMMM dd,yyyy', $toDateRegDate,$locale))
$videoDate
Finally, It's OK:
## tranformation of the data to dates : date.begin
#set($dateBegin = $date.toDate('yyyy-MM-dd',$!currentMessage.date.begin))
## tranformation of the data to dates : date.end
#set($dateEnd = $date.toDate('yyyy-MM-dd',$!currentMessage.date.end))
Ale
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With