dc_jt Posted March 1, 2007 Share Posted March 1, 2007 Hi Ive got this date function: $due = date('d/m/Y H:i:s'); which obviously displays todays date, how can I get it to display a week todays date?? Thanks Quote Link to comment Share on other sites More sharing options...
itsmeArry Posted March 1, 2007 Share Posted March 1, 2007 $timeStamp = strtotime($due); $timeStamp += 24 * 60 * 60 * 7; // (add 7 days) $newDate = date("d/m/Y H:i:s", $timeStamp); Quote Link to comment Share on other sites More sharing options...
dc_jt Posted March 1, 2007 Author Share Posted March 1, 2007 $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 Quote Link to comment Share on other sites More sharing options...
itsmeArry Posted March 1, 2007 Share Posted March 1, 2007 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... Quote Link to comment Share on other sites More sharing options...
dc_jt Posted March 1, 2007 Author Share Posted March 1, 2007 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 Quote Link to comment Share on other sites More sharing options...
itsmeArry Posted March 1, 2007 Share Posted March 1, 2007 you can change the format to which suits you... by changing date("d/m/Y H:i:s", $timeStamp); the heighlited ... Quote Link to comment Share on other sites More sharing options...
dc_jt Posted March 1, 2007 Author Share Posted March 1, 2007 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; ??? Quote Link to comment Share on other sites More sharing options...
itsmeArry Posted March 1, 2007 Share Posted March 1, 2007 Ok... leave the previous one... use this code it works fine $newDate = strtotime("+7 day", time()); $newDate = date("d/m/Y H:i:s", $newDate); Quote Link to comment Share on other sites More sharing options...
dc_jt Posted March 1, 2007 Author Share Posted March 1, 2007 Ok... leave the previous one... use this code it works fine $newDate = strtotime("+7 day", time()); $newDate = date("d/m/Y H:i:s", $newDate); Thank you so much, that works great Quote Link to comment Share on other sites More sharing options...
itsmeArry Posted March 1, 2007 Share Posted March 1, 2007 U are always welcome... and please do mark it as SOLVED Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.