CoderZone.org

Category: >> PHP Code >> Add and Subtract dates Bookmark and Share

<< lastnext >>

Snippet Name: Add and Subtract dates

Description: You can combine strtotime with the date function to create your own date. This is just an alternative to using mktime that's a little more intuitive.

Also see:
» Calculate days between any two dat...
» Easy date manipulation
» Convert UK Dates To mySQL Format D...
» Delete files older than 'X'
» String to Date
» Month, Day, Year dropdown boxes
» Calculate date of Easter Sunday
» Define a schedule of holidays
» Calendar for any month any year
» Basic PHP Calendar
» Convert 12 to 24 hour time and vic...
» What Season Is It?
» Delete by date
» Days in month #2
» Days in month #1
» Count days between dates
» Find days between dates #1
» Verify If Domain Really Exists
» Automatically Create Date Select B...

Comment: (none)

Author: Mike Rogers
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?php
 
$date = date('Y-m-d', strtotime("-30 days"));
$date = date('Y-m-d', strtotime("-10 years"));
$date = date('Y-m-d', strtotime("+30 days"));
 
?>
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 7