SOLVED

Date Format on Email Script

Go to solution
Stijn_Heijthuij
Level 7

Re: Date Format on Email Script

Hi Clare,

In Velocity, what approaches it is [$date.full_date]. If you want to take the more customized approach, take a look at this and adjust where you need to.

#set ( $dateObj = $date.toDate("yyyy-MM-dd", $Opportunity.DateField ) )

    #set ( $Day = $date.format("d", $dateObj) )

    #if ( $Day == "1" || "21" || "31" )

      #set ( $!Day = "${DelDay}st" )

    #elseif ( $Day == "2" || "22" )

      #set ( $!Day = "${DelDay}nd" )

    #elseif ( $Day == "3" || "23" )

      #set ( $!Day = "${DelDay}rd" )     

    #else

      #set ( $!Day ="${DelDay}th" )

    #end

    #set ( $Weekday = $date.format("E", $dateObj) )

    #set ( $Month = $date.format("MMMMM", $dateObj) )

    #set ( $Year = $date.format("yyyy", $dateObj) )

#end

Then just run the order you want. You might need to remove a few M's from the Month variable to get to Nov.

Monday, Nov. 30th, 2015.

${Weekday}, ${Month}. ${Day}, ${Year}.

Let me know if that works for you.