Jquery Time Processing __jquery
Last Update:2018-07-20
Source: Internet
Author: User
var timeobjectutil;
/**
* @title Time Tool class
* @note This class all violations verify return False
* @author {boonyachengdu@gmail.com}
* @date 2013-07-01
* @formatter "2013-07-01 00:00:00", "2013-07-01"
*/
Timeobjectutil = {
/**
* Get current time milliseconds
*/
Getcurrentmstime:function () {
var mydate = new Date ();
return Mydate.gettime ();
},
/**
* Millisecond Turn time format
*/
Longmstimeconverttodatetime:function (Time) {
var mydate = new Date (time);
Return This.formatterdatetime (mydate);
},
/**
* Time format to milliseconds
*/
Datetolongmstime:function (date) {
var mydate = new Date (date);
return Mydate.gettime ();
},
/**
* Format date (not including time)
*/
Formatterdate:function (date) {
var datetime = Date.getfullyear ()
+ "-"//"Year"
+ ((date.getmonth () + 1) > 10? (Date.getmonth () + 1): "0"
+ (Date.getmonth () + 1))
+ "-"//"Month"
+ (Date.getdate () < 10? "0" + date.getdate (): Date
. GetDate ());
return datetime;
},
/**
* Format date (including time "00:00:00")
*/
Formatterdate2:function (date) {
var datetime = Date.getfullyear ()
+ "-"//"Year"
+ ((date.getmonth () + 1) > 10? (Date.getmonth () + 1): "0"
+ (Date.getmonth () + 1))
+ "-"//"Month"
+ (Date.getdate () < 10? "0" + date.getdate (): Date
. GetDate ()) + "" + "00:00:00";
return datetime;
},
/**
* Format date (including time)
*/
Formatterdatetime:function (date) {
var datetime = Date.getfullyear ()
+ "-"//"Year"
+ ((date.getmonth () + 1) > 10? (Date.getmonth () + 1): "0"
+ (Date.getmonth () + 1))
+ "-"//"Month"
+ (Date.getdate () < 10? "0" + date.getdate (): Date
. GetDate ())
+ " "
+ (Date.gethours () < 10? "0" + date.gethours (): Date
. GetHours ())
+ ":"
+ (Date.getminutes () < 10? "0" + date.getminutes (): Date
. getminutes ())
+ ":"
+ (Date.getseconds () < 10? "0" + date.getseconds (): Date
. getseconds ());
return datetime;
},
/**
* Time Comparison {end time is greater than start time}
*/
Comparedateendtimegtstarttime:function (StartTime, Endtime) {
Return (new Date (Endtime.replace (/-/g, "/")) > (New Date (
Starttime.replace (/-/g, "/")));
},
/**
* Verify start time rationality {start time cannot be less than current time {X} months}
*/
Comparerightstarttime:function (month, starttime) {
var now = formatterdayandtime (New Date ());