Jquery Time Processing __jquery

Source: Internet
Author: User
Tags getdate
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 ());

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.