#set( $inTimeZone = $date.getTimeZone().getTimeZone('America/New_York') )
#set( $outTimeZone = $date.getTimeZone().getTimeZone('America/New_York') )
#set( $locale = $date.getLocale() )
#set( $myDate = $convert.parseDate("2016-09-06 11:00:00",'yyyy-MM-dd HH:mm:ss',$locale,$inTimeZone) )
#set( $dateOnly = $date.format('dd-MM-yyyy',$myDate,$locale,$outTimeZone) )
#set( $timeOnly = $date.format('hh:mm',$myDate,$locale,$outTimeZone) )
Thanks 🙂
And to print the time it should just be
#set( $inTimeZone = $date.getTimeZone().getTimeZone('America/New_York') )
#set( $outTimeZone = $date.getTimeZone().getTimeZone('America/New_York') )
#set( $locale = $date.getLocale() )
#set( $myDate = $convert.parseDate(${lead.dKSmartstarttidspunkt},'yyyy-MM-dd HH:mm:ss',$locale,$inTimeZone) )
#set( $dateOnly = $date.format('dd-MM-yyyy',$myDate,$locale,$outTimeZone) )
#set( $timeOnly = $date.format('hh:mm',$myDate,$locale,$outTimeZone) )
$timeOnly
$dateOnly
You don't need ${formal} notation to output just the variable because there isn't any surrounding text, but you might as well use it.
I see a lot of people using ${formal} in #set statements where it isn't necessary, just adding characters and possible typos.