Get current time:
var mydate = new Date ();//Current time
var year = Mydate.getfullyear ();//Current years
var month = Mydate.getmonth () + 1;//Current Month
var day = Mydate.getdate ();//Current date
Mydate.getyear (); Get Current year (2-bit)
Mydate.getfullyear (); Get the full year (4-bit, 1970-????)
Mydate.getmonth (); Get the current month (0-11, 0 for January)
Mydate.getdate (); Get current day (1-31)
Mydate.getday (); Get Current week x (0-6, 0 for Sunday)
Mydate.gettime (); Gets the current time (the number of milliseconds since 1970.1.1)
Mydate.gethours (); Get current number of hours (0-23)
Mydate.getminutes (); Gets the current number of minutes (0-59)
Mydate.getseconds (); Gets the current number of seconds (0-59)
Mydate.getmilliseconds (); Gets the current number of milliseconds (0-999)
Mydate.tolocaledatestring (); Get Current date
var mytime=mydate.tolocaletimestring (); Get current time
Mydate.tolocalestring (); Get Date and time
var oneday = 1000 * 60 * 60 * 24;
Get the date of the last week
var lastdate = new Date (Mydate-oneday * 6);
var lastyear = Lastdate.getfullyear ();
var lastmonth = lastdate.getmonth () + 1;
var lastday = Lastdate.getdate ();
Get the last day of the current month
var day = new Date (year, month, 0);
var lastdate = Day.getdate ();//The last day of the current month
Gets the date of the last n months
var lastdate = new Date (Mydate-oneday * mydate.getdate ());
Lastdate = new Date (LASTDATE-N * oneday * (Lastdate.getdate ()-1));
var lastyear = Lastdate.getfullyear ();
var lastmonth = lastdate.getmonth () + 1;
var lastday = Lastdate.getdate ();
string conversion to Timestamp
var date= "2014-05-08 00:22:11";
Date = new Date (Date.parse (Date.replace (/-/g, "/")));
Date = Date.gettime ();
JS Convert date string to timestamp star small stack