Recently used functions that feel useful for JS operation time (Continued ...)

Source: Internet
Author: User

Recently used functions that feel useful for JS operation time (Continued ...)

// Judge whether the time is equal function compareDate (date1, date2) {// equal if (date1 = date2) {return true;} var startTime = date1; var start = new Date (startTime. replace (/-/g, "/"); var endTime = date2; var end = new Date (endTime. replace (/-/g, "/"); if (end! = Start) {return false;} return true ;}


// Determine whether the time is in the range function datetimeComper (year, month, day, currtime) {// var curr = "09:00:00"; var begin = "09:00:00 "; var end = "16:00:00"; var currd = new Date (year, month, day, currtime. split (":") [0], currtime. split (":") [1], currtime. split (":") [2]); var begind = new Date (year, month, day, begin. split (":") [0], begin. split (":") [1], begin. split (":") [2]); var endd = new Date (year, month, day, end. split (":") [0], end. split (":") [1], end. split (":") [2]); if (currd >=begind & currd <= endd) {return true;} else {return false ;}}


Zookeeper

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.