Change Date Format in suitescript

If you want to change the date format in suitescript the following sample will be used.

First load the N/format module

Then pass your date field into Date function like

let dateField=new Date(lastDonateDate);     

Then assign your date format into a varaible,                        

let myDateFormat=’M/D/YYYY’       

Then use format.parse to change the date format       

let formattedDate = format.parse({                   

value: dateField,                   

type: format.Type.DATE,                   

format: myDateFormat               

  });

Leave a comment

Your email address will not be published. Required fields are marked *