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