Jump to content

Help needed with date. 5-7 working days in advance


jonnyw6969

Recommended Posts

there are multiple methods, the easiest being the time(); function with an offset, an example of 5 days after the current date would be:

 

time()+432000;

 

432000 is 5 days in seconds as time() deals in seconds.

 

--edit:

you can then use the date() function to extrapolate a human readable date format

 

Link to comment
Share on other sites

you would need to check if its monday, if its not then you would add 2 days (weekend), and if its sunday you would only add 1 day, eg:

 

$dtime = 432000; // 5 days

if(date("D") != "Mon" && date("D") != "Sun"){
  $deliverytime = $dtime + 172800; // add 2 days
}elseif(date("D") == "Sun"){
  $deliverytime = $dtime + 86400; // add 1 day
}

$delivery = time()+$deliverytime;

 

hope this helps,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.