JavaScript date 

Joined:
01/15/2009
Posts:
30

February 03, 2010 04:39:18
Ways to use JavaScript date function:
// current time
new Date();

new Date(0);  // Wed Dec 31 1969 18:00:00 GMT-0600

new Date(0).toUTCString(); // Thu, 01 Jan 1970 00:00:00 GMT

// this format is locale specific
new Date('12/23/2009');  // Wed Dec 23 2009 00:00:00 GMT-0600

// does this make sense?
new Date('22/99/2009'); // Fri Jan 07 2011 00:00:00 GMT-0600

// initialize with long string
new Date('Fri Jan 07 2011 12:59:'); // Fri Jan 07 2011 12:59:00 GMT-0600

// initialize with year, month, day, hour, etc...
new Date(2009, 12, 23, 15); // Sat Jan 23 2010 15:00:00 GMT-0600
new Date(2009, 12, 23, 75); // Tue Jan 26 2010 03:00:00 GMT-0600

// 3 hours from now
new Date(new Date().getTime() + 3 * 3600 * 1000);
[ Comment  | Tags ]