Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:43:56+00:00 2026-05-23T20:43:56+00:00

I would like validate the current date with question posted date if date difference

  • 0

I would like validate the current date with question posted date if date difference is greater then 1 day then it needs to show in over due question also this will not consider the array of dates which are already i having in my array.

Like if a question posted on 20-July-11.

exemption date array {’21-July-11′, … etc}
current date is 22-July-11

then the output needs to be shown like question is waiting for 1 day instead of 2 days.

can any one help on it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:43:57+00:00Added an answer on May 23, 2026 at 8:43 pm

    That is some example code I have created for you to calculate the due date. When you submit a question, calculate the due date that way and store it in the database with entry for that question…

    <?php
    
    $daysDue = 2;
    $exDatesArray = array("2011-07-21", "2011-07-23"); //array with all your holiday dates.
    $question_1_Date = "2011-07-21";
    $question_2_Date = "2011-07-18";
    $question_3_Date = "2011-07-20";
    
    echo "Holidays on: ";
    foreach( $exDatesArray AS $exdate )
    {
        echo $exdate . ", ";
    }
    echo "<br/><br/>";
    echo "submit date -> due date<br/>";
    echo $question_1_Date . " -> " . calculateDueDate( $question_1_Date, $exDatesArray, $daysDue ) . "<br/>";
    echo $question_2_Date . " -> " . calculateDueDate( $question_2_Date, $exDatesArray, $daysDue ) . "<br/>";
    echo $question_3_Date . " -> " . calculateDueDate( $question_3_Date, $exDatesArray, $daysDue );
    
    function calculateDueDate( $date, $exDates, $daysDue )
    {
        //start with day 1
        $count = 1;
    
        //now we loop from day one to due days
        while( $count <= $daysDue )
        {
            //add one day to start date
            $date = add_date( $date, 1 );
            //check if that new date is a holiday
            if( !in_array($date , $exDates) )
            {
                //only if it is not a holiday we increase counter, otherwise we dont count that day towards due period
                $count++;
            }
        }
    
        //return calculated due date
        return $date;
    }
    
    function add_date($date,$days)
    { 
        $cd = strtotime($date); 
        return date('Y-m-d', mktime(0,0,0,date('m',$cd),date('d',$cd) + $days, date('Y',$cd))); 
    }
    ?>
    

    Output:

    Holidays on: 2011-07-21, 2011-07-23, 
    
    submit date -> due date
    2011-07-21 -> 2011-07-24
    2011-07-18 -> 2011-07-20
    2011-07-20 -> 2011-07-24
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to validate an email using the RegexValidator, e.g. [RegexValidator(@^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$)] Which works
I'm using jQuery Validate and would like to re-validate a group of fields whenever
I have some MET data I want to validate which would look something like
I would like to validate the presence of a file with paperclip. When I
$(#commentForm).validate({ rules: { insurance1$ucBuildingInsurance$txtOtherReasonDescription: required } }); My current script looks like this to
I would like to validate the JSON being passed in, currently the method is
I would like to validate the cXML Invoice against the DTD using Linq to
I'm using jQueryValidation and I would like to validate my form without needing to
I would like to validate the users choice of folder name in a gtk.FileChooser
I would like to validate that customer_price >= my_price . I tried the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.