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

Thank you for your response. I tried this:

{% "Date: " + Date.ToShortDateString() #%}

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

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"} #%}

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

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")} #%}

0 votesVote for this answer Mark as a Correct answer

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