Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Date 将日期的持续时间与所选下拉列表值进行比较…请阅读_Date_Duration - Fatal编程技术网

Date 将日期的持续时间与所选下拉列表值进行比较…请阅读

Date 将日期的持续时间与所选下拉列表值进行比较…请阅读,date,duration,Date,Duration,我有一个下拉列表,值为一年、两年……等等。。好啊此外,我有两个ajax文本框与日历延长。如果下拉选择值为一年,并且两个文本框值之间的持续时间表示日期不匹配,我想弹出警报消息。明白我的意思吗?请帮助我。您希望使用哪种语言,…?对不起,我已经为您提供了有关需求的粗略代码逻辑。我希望它将对您有用是的,它将在客户端蠕虫。 Algorithm : 1.Get the both date from the text box. 2. The find the epcoch time for each date

我有一个下拉列表,值为一年、两年……等等。。好啊此外,我有两个ajax文本框与日历延长。如果下拉选择值为一年,并且两个文本框值之间的持续时间表示日期不匹配,我想弹出警报消息。明白我的意思吗?请帮助我。

您希望使用哪种语言,…?对不起,我已经为您提供了有关需求的粗略代码逻辑。我希望它将对您有用是的,它将在客户端蠕虫。 Algorithm : 1.Get the both date from the text box. 2. The find the epcoch time for each date. // 3. subtract the both dates. 4. subtract_result = 365*24*60*60 // Finding the 1 year timestamp values 5. So, it the difference exceed than above calculation , you could sure that the date is mis matching.

    // This is for first date
    first = new Date(2010, 03, 08, 15, 30, 10); // Get the first date epoch object
   // document.write((first.getTime())/1000); // get the actual epoch values
    second = new Date(2012, 03, 08, 15, 30, 10); // Get the first date epoch object
    //document.write((second.getTime())/1000); // get the actual epoch values
    diff= second - first ;
    one_day_epoch = 24*60*60 ;  // calculating one epoch
    if ( diff/ one_day_epoch > 365 ) // check , is it exceei
    {
    alert( 'date is exceeding one year');
    }