Customise Date Format in Form Notification Email

Luke Tappin asked on January 8, 2015 17:45

Hi. Regarding the 'Notification Email' section of the 'Forms' system, I'm using a 'Custom Layout' and this is the code that I'm currently using: ('Date' is a date field)

{% "Date: " + Date #%}

This outputs: "Date: 08/01/2015 00:00:00 "

How can I change the output to only show the date, and not the time; to show this: "Date: 08/01/2015"?

Thank you!

Recent Answers


Joshua Adams answered on January 8, 2015 18:45

There should be a to short date string method or something of that sort that you can add to the Date macro.

Maybe Date.ToShortDateString() . Just a guess.

1 votesVote for this answer Mark as a Correct answer

Luke Tappin answered on January 9, 2015 10:36 (last edited on March 24, 2018 12:15)

Thank you for your response. I tried this:

{% "Date: " + Date.ToShortDateString() |(user)zbynekh|(hash)98774cd9c8d5b7c0607479ac01fa41b6906b438aa273c06084f4401c68f6d7e8%}

I received this error message through the system: "[MacroExpression.Evaluate]: 'ToShortDateString' is not a known method name."

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 9, 2015 13:31

This should do it: {% ToShortDateString(CurrentDateTime) %}

0 votesVote for this answer Mark as a Correct answer

Luke Tappin answered on January 9, 2015 14:53 (last edited on March 24, 2018 12:15)

I tried both of the following:

{% ToShortDateString(CurrentDateTime) %}

{% ToShortDateString(Date) %}

And had the same problem: "ToShortDateString(Date)" & "ToShortDateString(CurrentDateTime)"

Interestingly, the following code does work:

{% "Date: " + GetDateTime(Date, "d") + " additional statement" %}

Outputs: "Date: 04/01/2015 additional statement"

But this code does not work, and I need to add this into an 'if' statement, so it can't be stated on its own:

{% if (Period == "1 Day") {"Date: " + GetDateTime(Date, "d") + " additional statement"} |(user)zbynekh|(hash)386708af92ed9648a1c25944c6e7294f4379d1fd84bd87ecb8a25fc6084121c9%}

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 9, 2015 20:19

It could be a macro permissions issue. Try not signing the macro by using this {% ToShortDateString(CurrentDateTime) @%}

0 votesVote for this answer Mark as a Correct answer

Luke Tappin answered on January 12, 2015 12:50 (last edited on March 24, 2018 12:15)

I tried entering the following 3 lines:

1 {% ToShortDateString(CurrentDateTime) %}

2 {% ToShortDateString(CurrentDateTime) %}

3 {% ToShortDateString(CurrentDateTime) @%}

None of the above worked (returned: "[MacroExpression.Evaluate]: 'ToShortDateString' is not a known method name."), however, after trying some other scenarios, the below code now seems to work:

{% if (Period == "") {""} else {"Date: " + GetDateTime(Date, "d")} |(user)zbynekh|(hash)f57af2604447c06a4ccc0ddaa369bb1d2bffdb5ca92e67c38d70117b9dc3d064%}

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.