The user can use SuiteScript to get the current date or time by using the supplied code. It helps format dates in emails, printed forms, and other editable text.
let ausCurDateTime = format.format({
value: new Date(),
type: format.Type.DATETIMETZ,
timezone: 'Australia/Sydney' // Preferred Timezone
});
log.debug('ausCurDateTime', ausCurDateTime);
const dateParts = ausCurDateTime.split(/\/|\s|:/); // Split the input string into date and time parts
let day = dateParts[0];
let month = dateParts[1];
const year = dateParts[2];
let hours = parseInt(dateParts[3]) + (dateParts[5].toLowerCase() === 'pm' ? 12 : 0); // Convert 12-hour format to 24-hour format
let minutes = dateParts[4];
day = day.toString().padStart(2, '0');
month = month.toString().padStart(2, '0');
hours = hours.toString().padStart(2, '0');
minutes = minutes.toString().padStart(2, '0');
// Create a new Date format with the given date and time parts
const convertedDate = `${year}-${month}-${day}T${hours}:${minutes}:00+10:00`; //Preferred Format