Correct notation for date objects

Source: Internet
Author: User

In the development process, often encounter such a problem, we need to choose a time interval, the preceding month and the day must be smaller than the back of the month and the day of the time, seconds and minutes, we choose this interval in the interaction is reasonable, correct. This involves the comparison of time, generally we choose to get the time, converted to milliseconds to compare. So the question is, when the day of the month is converted to milliseconds, the correct writing format is:

1 year-month-day hours:minutes:seconds

Demo

1$beinging = "2016-10-19";2$sltDTBeginHour = ' 10 ';3$sltDTBeginMinute = ' 10 ';4$sltDTBeginSecond = ' 10 ';5$ended = "2016-10-20";6$sltDTEndHour = ' 14 ';7$sltDTEndMinute = ' 14 ';8$sltDTEndSecond = ' 14 ';9Start = (NewDate ($beinging + ' + $sltDTBeginHour + ': ' + $sltDTBeginMinute + ': ' +$sltDTBeginMinute). GetTime ());TenEnd = (NewDate ($ended + ' + $sltDTEndHour + ': ' + $sltDTEndMinute + ': ' +$sltDTEndMinute). GetTime ()); One Console.log (start); A Console.log (end); -   if(start>end) { -Alert ("Please enter the correct end date and end Date"); the}

2. Second wording of the time format:

1 year/month/day hours:minutes:seconds

3. The third way to format the time:

Year,month,day Hours:monutes:seconds

If there is a better way of writing, also welcome colleagues can also share to me.

Correct notation for date objects

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.