- ============看代码============================================================
-
(function($)
{ -
$.extend({ -
myTime: { -
-
DateToUnix: function(year, month, day, hour, minute, second){ -
var oDate = new Date(Date.UTC(parseInt(year), -
parseInt(month), -
parseInt(day), -
parseInt(hour), -
parseInt(minute), -
parseInt(second) -
) -
); -
return (oDate.getTime()/1000); -
}, -
-
UnixToDate: function(unixTime, isFull, timeZone){ -
if (typeof(timeZone) == 'number') -
{ -
unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60; -
} -
var time = new Date(unixTime*1000); -
var ymdhis = ""; -
ymdhis += time.getUTCFullYear() + "-"; -
ymdhis += time.getUTCMonth() + "-"; -
ymdhis += time.getUTCDate(); -
if ( isFull === true ) -
{ -
ymdhis += " " + time.getUTCHours() + ":"; -
ymdhis += time.getUTCMinutes() + ":"; -
ymdhis += time.getUTCSeconds(); -
} -
return ymdhis; -
} -
} -
}); -
})(jQuery);
jquery日期转换
最新推荐文章于 2021-07-23 10:45:12 发布