2 Replies Latest reply on Jul 15, 2020 7:40 AM by RajeshPokala

    RPL to format a data source date




      I have a datetime within a campaign data source that I am trying to format using RPL.


      The format that I'd like it to be in is:

      01 Jan, 2020


      I can't seem to get it right, could anyone help me please?

        • 1. Re: RPL to format a data source date

          Hi 3149299,


          Maybe you have found a solution by now but if you are interested in showing the date in an email, what I usually do is I treat as a string and format it accordingly.

          For example I have a variable "varInvoiceDueDate" in which the date is stored as 2019-09-12 14:00:00 so I break it down in parts and recostruct it as I want:

          ${varInvoiceDueDate?substring(8, 10)}/${varInvoiceDueDate?substring(5, 7)}/${varInvoiceDueDate?substring(0, 4)}.


          Also have a look at the RPL function: exp?datetime (e.g. ?datetime("yyyy-MM-dd hh:mm a")> but bear in mind it doesn't work on all cases.





          • 2. Re: RPL to format a data source date



            You can use below formats:


            <#assign dateVal = "10/25/1995"?date("MM/dd/yyyy")>

            ${dateVal?string('dd MMM, yyyy')}}


            ${<<source variable>>?date?string('dd MMM, yyyy')}}