Free Php Scripts, Articles and Resources
    home  Home   php  PHPscripts   articles  Articles   contact  Contact
Date: 13 March 2010
in

Total scripts: 203
Total downloads: 25548
Total articles: 11

Latest Scripts
Free Contact Us Script +...
Free PHP ODP Script

Top Downloaded Scripts
Captcha Security Images
dGallery

Best Rated Scripts
File Searcher
Transparent Watermark

CATEGORIES

PHP ARTICLES

<< All Php Articles



 
Adding a number of days to a calendaristic date
 
     

Many times it is needed to add a number of days to a date (e.g. to determine the expiration date for a link). To do this, you may use the following php code:

$days_to_add = 30;
$current_date = date('Y-m-d H:i:s'); //get the current date
$timeStmp = strtotime($current_date) + $days_to_add * 24 * 60 * 60; //generate a timestamp for the new date
$final_date = gmdate ('Y-m-d H:i:s', $timeStmp); //obtain the final date

 

That should be all.

 
<< All Php Articles