SOLVED

Date Format Velocity Script

Go to solution
Jim_Clarke
Level 2

Hello,

It's been a while since I formatted dates with Velocity, I'm struggling with the DateTool methods and was wondering if someone had an example.

Here's my snippet:

##sets timestamp variable

#set ( $NextAppointment = ${OpportunityList.get(0).NextPhoneCallAppointment__c})

##This displays the timestamp unformatted

$NextAppointment

##This should display the timestamp formatted

$date.format('medium',$NextAppointment)

My sample emails renders like this, clearly the method is working:

2015-06-18 17:30:00 $date.format('medium',$NextAppointment)

I was using this example to get to this state:

DateTool (VelocityTools 2.0-beta4 Documentation)

Any help would be greatly appreciated as to what I might be doing incorrectly on calling the method.

Tags (2)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

So with "medium" you're wanting something like Jun 18, 2015 5:30 PM?

If that's the case, something like this might work. I tested it with a similar field but don't know what format you're date was originally in:

$date.format('MMM dd, yyyy hh:mm aa', ${convert.parseDate(${OpportunityList.get(0).NextPhoneCallAppointment__c}), 'yyyy-MM-dd HH:mm:ss')})

View solution in original post

19 REPLIES 19