The time-to-timestamp format is converted to each other (conversion primary compatible IE8,IE8 does not support new Date ())
(function ($) {$.extend ({myTime: {curtime:function () } {returnDate.parse (NewDate ())/1000;}, Datetounix:function (string) {//time-to-timestamp var f= String.Split ("', 2); var d= (F[0]? F[0]: '). Split ('-', 3); var t= (F[1]? F[1]: '). Split (': ', 3); return(NewDate (parseint (d[0], 10) | |NULL, (parseint (d[1], ten) | | 1)-1, parseint (d[2], 10) | |NULL, parseint (T[0], 10) | |NULL, parseint (t[1], 10) | |NULL, parseint (t[2], 10) | |NULL). GetTime ()/1000;},
Unixtodate:function (Unixtime, Isfull, TimeZone) {//timestamp turn time
if(typeof (TimeZone) = = ' number ') {
Unixtime = parseint (unixtime) + parseint (timeZone) * 60 * 60;
}
var time =NewDate (Unixtime);
var ymdhis = "";
Ymdhis + = Time.getutcfullyear () + "-";
Ymdhis + = (time.getutcmonth () + 1) + "-";
Ymdhis + = Time.getutcdate ();
if(Isfull = = ' true ') {
Ymdhis + = "+ time.getutchours () +": ";
Ymdhis + = time.getutcminutes () + ":";
Ymdhis + = Time.getutcseconds ();
}
returnymdhis;}}); }) (JQuery);
jquery add time and time stamp to convert components to each other