How to change email template date format

change date format from mm/dd/yyyy to dd/mm/yyyy in netsuite email template

Original-${transaction.trandate}

 

Beginner Asked on July 10, 2023 in SuiteScript.
Add Comment
21 Answer(s)

I can get it to save if I edit Source:

RE: How to change email template date format

But even just editing and saving after that causes an error.

It looks like there may be an issue with the editor.

One alternative you could look at is using a file instead of the in-built editor – available under “Create Template From”.

Intermediate Answered on July 10, 2023.
Add Comment

Hi,

For an individual field, you can use this:

?string("dd/MM/yyyy")

Alternatively, adding this at the tope of your template should set the default string format for dates:

<#setting date_format="d MMM yyyy">

Thanks,

Chris

Intermediate Answered on July 10, 2023.
Add Comment

Thanks Chris for response!

But with  this ${transaction.trandate?string(“dd/MM/yyyy”)}

I am getting following error

The template cannot be saved due to the following errors:
Syntax error in template “content” in line 3, column 46:. Encountered “style”, but was expecting one of these patterns:.
<TERMINATING_EXCLAM>
<DOT_DOT_LESS>.
“*” “?”. “??” “!”.
“T”. “(“.”)”.
Parse exception during template merging.

Beginner Answered on July 10, 2023.
Add Comment

Are you able to share a larger section of your template?

Thanks,

Chris

Intermediate Answered on July 10, 2023.
Add Comment
Beginner Answered on July 10, 2023.
Add Comment

I think something unexpected might have copied across. Could you please view the Source.

Intermediate Answered on July 10, 2023.
Add Comment

But when I simply print {transaction.trandate} it prints properly. I am not getting why error comes while converting.

Beginner Answered on July 10, 2023.
Add Comment

Did you type ${transaction.trandate?string(“dd/MM/yyyy”)} or copy it from here?

If you copied it then it can sometimes bring across additional formatting, etc.

Intermediate Answered on July 10, 2023.
Add Comment

Now I tried by typing but then also getting same error

Beginner Answered on July 10, 2023.
Add Comment

Apologies – could you try this:

?string["dd/MM/yyyy"]

i.e. square braces. I copied the code from some documentation but missed that.

Intermediate Answered on July 10, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor