Jump to content

Dynamic future dates


pthurmond

Recommended Posts

No, but there are functions that will allow you to do this, more notably functions such as mktime I believe which can be used in conjunction with date(). 

There is an example of date and mktime together in the manual at this page:
http://www.php.net/manual/en/function.date.php

HTH

Dest
Link to comment
https://forums.phpfreaks.com/topic/27056-dynamic-future-dates/#findComment-123750
Share on other sites

The following is copied from www.php.net/time:
[code]
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
                  // 7 days; 24 hours; 60 mins; 60secs
echo 'Now:      '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
?>
[/code]
So the following should give you 30 days from now:
[code]
<?php
$days = time() + (30 * 24 * 60 * 60);
                  // 30 days; 24 hours; 60 mins; 60secs
echo 'Now:      '. date('Y-m-d') ."\n";
echo '<br>30 Days from now: '. date('Y-m-d', $days) ."\n";
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/27056-dynamic-future-dates/#findComment-123752
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.