Implementation Code of JS Judgment time period and js judgment code

Source: Internet
Author: User

Implementation Code of JS Judgment time period and js judgment code

If you don't talk much about it, paste the Code directly. The specific code is as follows:

<Th> transaction Start Time: </th> <td> <input id = "bcconDateBeginDate" name = "bcconDateBeginDate" value = "2016/06/12 00:00:00" class = "easyui-datetimebox" editable = "false" style =" width: 150px; "/> </td> <th> transaction End Time: </th> <td> <input id = "bcconDateEndDate" name = "bcconDateEndDate" value = "2016/06/12 23:59:59" class = "easyui-datetimebox" editable = "false" style =" width: 150px; "/> </td> var v = $ ('# bcconDateBeginDate '). datetimebox ('Getvalue'); if (v. length> 0) {var date = new Date (); var year = date. getFullYear (); var month = date. getMonth () + 1; var strDate = date. getDate (); if (month> = 1 & month <= 9) {month = "0" + month;} if (strDate> = 0 & strDate <= 9) {strDate = "0" + strDate;} var nowdate = year + "/" + month + "/" + strDate; var data1 = Date. parse (v. substring (0, 10 ). replace (/-/g, "/"); var data2 = Date. parse (nowdate ); Var datadiff = data2-data1; var time = 6*24*60*60*1000; if (datadiff> time) {$. messager. alert ('hprompt ',' the start time cannot exceed 7 days before the current time! '); Return ;}}

The above is the implementation code of the JS judgment period introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!

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.