Pages

Sunday, November 15, 2015

Velocity Template Format Date and Decimals

#set ( $String = "formatter" )
$String.format("%5.2f", $val)
--Turn 123.41234 into 123.41 the same as decimal (5, 2) in T-SQL


$String.format("%.10s", $date)
--Turn datetime into 2015-01-01





For GG using velocity:
#set ( $String = "formatter" )
#set ( $Double = 1.0 )

$String.format("%15.2f", $Double.parseDouble($col.AfterValue))
date:                   $col.AfterValue.substring(0,10)
time:                   $col.AfterValue.substring(11,23)

No comments:

Post a Comment