WebMe
homeaboutportfolioservicescontact

WebMe - Website Design & Development

previous posts
archives
 

All resources published on this blog are free to use and redistribute. All we ask is that you keep any copyright notices and links to WebMe in your code. If you find something really useful we would appreciate you placing a link on your site to ours.

 
uk web design association Independent Web Developers Portal
This is a Carbon Neutral website Follow us on Twitter
All major credit cards accepted
Web Site Design BlogSubscribe to this Blog

How to add days, weeks, months to any date in PHP

How to add days, weeks, months to any date in PHP

$date = date("Y-m-d");// current date

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");

To subtract just use - instead of +.

In PHP>=5.3.0 you can use the DateTime functions.

Labels:

Design web site media
0 Comments

 

info@webme.co.uk

copyright About UsServicesPortfolioDemoGet QuoteContact