javascript set date to local time code example
Example 1: js get local date
var now = new Date();
console.log(now.toLocaleDateString()); // expected output: 2/26/2021 (MM/DD/YYYY)
Example 2: Date object for local time and date
now.toLocaleString(undefined, {
day: 'numeric',
month: 'numeric',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
});