datetime create in javascript code example
Example 1: javascript current date time
var today = new Date().toLocaleDateString(undefined, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
})
Example 2: js set datetime
//new Date(year, month, day, hours, minutes, seconds, milliseconds)
new Date(1776, 6, 4, 12, 30, 0, 0);
// Timestamp method
new Date(-6106015800000);
// Date string method
new Date("January 31 1980 12:30");