To generate today’s date in add/mm/yyyy format that reflects local time, not UTC, within a SuiteScript environment.
let today = new Date();
let localDate = new Date(today.getTime() + (today.getTimezoneOffset() * 60000));
let dd = ('0' + localDate.getDate()).slice(-2);
let mm = ('0' + (localDate.getMonth() + 1)).slice(-2);
let yyyy = localDate.getFullYear();
let formattedDate = dd + '/' + mm + '/' + yyyy;
Explanation
new Date() -Gets the current system time (in UTC)getTimezoneOffset() -Returns the difference in minutes between UTC and local timetoday.getTime() + offset -Adjusts the timestamp to reflect local time('0' + val).slice(-2).Ensures 2-digit formatting (e.g., “03” instead of “3”)formattedDate -Concatenates the values into the desireddd/mm/yyyystring