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

  • Home
  • SEARCH
  • 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 4246358
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:57:46+00:00 2026-05-21T03:57:46+00:00

Does anyone have a PHP snippet to calculate the next business day for a

  • 0

Does anyone have a PHP snippet to calculate the next business day for a given date?
How does, for example, YYYY-MM-DD need to be converted to find out the next business day?

Example:
For 03.04.2011 (DD-MM-YYYY) the next business day is 04.04.2011.
For 08.04.2011 the next business day is 11.04.2011.

This is the variable containing the date I need to know the next business day for

$cubeTime['time'];

Variable contains: 2011-04-01
result of the snippet should be: 2011-04-04

  • 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-21T03:57:46+00:00Added an answer on May 21, 2026 at 3:57 am

    Next Weekday

    This finds the next weekday from a specific date (not including Saturday or Sunday):

    echo date('Y-m-d', strtotime('2011-04-05 +1 Weekday'));
    

    You could also do it with a date variable of course:

    $myDate = '2011-04-05';
    echo date('Y-m-d', strtotime($myDate . ' +1 Weekday'));
    

    UPDATE: Or, if you have access to PHP’s DateTime class (very likely):

    $date = new DateTime('2018-01-27');
    $date->modify('+7 weekday');
    echo $date->format('Y-m-d');
    

    Want to Skip Holidays?:

    Although the original poster mentioned “I don’t need to consider holidays”, if you DO happen to want to ignore holidays, just remember – “Holidays” is just an array of whatever dates you don’t want to include and differs by country, region, company, person…etc.

    Simply put the above code into a function that excludes/loops past the dates you don’t want included. Something like this:

    $tmpDate = '2015-06-22';
    $holidays = ['2015-07-04', '2015-10-31', '2015-12-25'];
    $i = 1;
    $nextBusinessDay = date('Y-m-d', strtotime($tmpDate . ' +' . $i . ' Weekday'));
    
    while (in_array($nextBusinessDay, $holidays)) {
        $i++;
        $nextBusinessDay = date('Y-m-d', strtotime($tmpDate . ' +' . $i . ' Weekday'));
    }
    

    I’m sure the above code can be simplified or shortened if you want. I tried to write it in an easy-to-understand way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have a PHP function that for example if a mysql_error() happens due
Does anyone have any experience using PHP to send an sms via skype I
Does anyone have any recommendations for implementations of ActiveRecord in PHP? I've been using
Does anyone have a solid benchmark about the speed of parsing PHP code comments?
Does anyone have a library or have a way in PHP or JAVA to
Does anyone know of a robust (and bullet proof) is_JSON function snippet for PHP?
Does anyone have a php class, or regex to parse an address into components?
I need a very basic, simple and lightweight AJAX script. Does anyone have a
Does anyone have a PHP script to share that displays current server disk usage?
Does anyone have any suggestions on how to implement a activation license for PHP

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.