...
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) |
To increase one day in ISO Date
Code Block |
---|
function IncDate( src) // src should be "YYYY-MM-DD" like "2009-04-13"
{
var d = new Date(src);
d.setDate(d.getDate()+1);
var ret = d.getFullYear().toString() + "-" + ((d.getMonth()<9) ? "0":"") + (d.getMonth()+1).toString() + "-" + ((d.getDate()<10) ? "0":"") + d.getDate().toString();
return ret;
} |