Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
var d = new Date();
var n = d.toString();


To set values for Date()

Code Block
var d= new Date("1973-02-16")

d.setFullYear(2020); // Set the year (optionally month and day)
d.setFullYear(2020,12,30); // Set the year (optionally month and day)
d.setMonth(11); // Set the month (0-11)
d.setDate(25); // Set the day as a number (1-31)
d.setHours(12); // Set the hour (0-23)
d.setMilliseconds(22); // Set the milliseconds (0-999)
d.setMinutes(10); // Set the minutes (0-59)
d.setSeconds(0); // Set the seconds (0-59)
d.setTime(12311231); // Set the time (milliseconds since January 1, 1970)