Jump to content

date function plus a week


dc_jt

Recommended Posts

$timeStamp = strtotime($due);
$timeStamp += 24 * 60 * 60 * 7; // (add 7 days)
$newDate = date("d/m/Y  H:i:s", $timeStamp);

 

Hi thanks for your help but that seems to ouput:

 

2007-01-10 11:39:17

 

When I echo it? Any idea why???

 

Thanks

Link to comment
Share on other sites

because it was

$newDate = date("Y-m-d  H:i:s", $timeStamp); earlier

 

I just editted it. to

$newDate = date("d/m/Y  H:i:s", $timeStamp);

 

I think you used previous one.. have a look at that...

 

Thanks, you were right, however I have to have it in Y-m-d  H:i:s format because I have a calendar which works in this format. Is it possible doing it this way?

 

Thanks

Link to comment
Share on other sites

you can change the format to which suits you...

 

by changing

date("d/m/Y  H:i:s", $timeStamp);

the heighlited ...

 

 

When I change the format though I get 10/1/2007

 

Im using this:

 

$due = date('d/m/Y H:i:s');

$timeStamp = strtotime($due);

$timeStamp += 24 * 60 * 60 * 7; // (add 7 days)

$newDate = date("d/m/Y H:i:s", $timeStamp);

echo $newDate;

 

???

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.