SOLVED

Re: Get time from timestamp

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Get time from timestamp

#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) )

Rasmus_Bidstru1
Level 4

Re: Get time from timestamp

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

right? or is it ${dateOnly}
SanfordWhiteman
Level 10 - Community Moderator

Re: Get time from timestamp

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.