Home >Web Front-end >JS Tutorial >javascript time comparison implementation code_time and date

javascript time comparison implementation code_time and date

WBOY
WBOYOriginal
2016-05-16 18:43:131110browse

In web development, it is sometimes necessary to compare the time in the input box (mainly the start time and end time). After searching online, I found that many of them are invalid. The following method has been tested by my brother and is indeed effective, so I would like to share it. (Please pay attention to the red part)

function ValidtorTime(){                                                                                                                                                         
var d2 = new Date(document.getElementById('txbToDate')

.value.replace(/-/g, "/")); var d2 if(d1>d2)                                                                                                                                                                                                          ;
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn