greenninja
greenninja

Reputation: 7

How do I change the date format from mm/dd/yyyy to mm-dd-yyyy

I'm trying to change the date format of a pdf output from mm/dd/yyyy to mm-dd-yyyy.

<table style="position: absolute;overflow: hidden;left: 410pt;top: 15pt;height: 15pt;width: 150pt;"><tr>
<td>${check.trandate}</td>
</tr></table>`

the current output of this is mm/dd/yyyy but i need the "/" to be "-"

Upvotes: 0

Views: 587

Answers (2)

bknights
bknights

Reputation: 15402

Netsuite is quite inconsistent in this area

to cover some dates you can use a default date format:

The following should handle Netsuite's built in dates (like trandate) so it should suffice for your case. Place these elements at the top of your xml template file:

<#setting date_format="MM-dd-yyyy">
<#setting datetime_format="MM-dd-yyyy">

Other times you need to explicitly set the date format. I've run into this case mostly with custom date fields:

${check.trandate?string["MM-dd-yyyy"]}

Upvotes: 1

Qiimiia
Qiimiia

Reputation: 607

You can do it like this:

check.trandate = check.trandate.replaceAll('/', '-');

Upvotes: 1

Related Questions