Hmm it dosnt work. When I put a typed string in, it works, but when i use my lead. attribute, it dosnt work anymore.
#set($mytime = ${lead.dKSmartstarttidspunkt})
$mytime (this displays as 2016-09-05 10:20:10)
They i try to use it in the code, and it just shows nothing :-(
#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
Now it works!
I just needed to remove the ss in 'yyyy-MM-dd HH:mm:ss'