Home >> Snippet List >> 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
PHP Snippet
<?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"));
 
?>