You can use strtotime
:
$date = strtotime('2010-01-01 -1 year');
The strtotime
function returns a unix timestamp, to get a formatted string you can use date
:
echo date('Y-m-d', $date); // echoes '2009-01-01'
More Related Contents:
- Php date() Date and time is stuck [closed]
- Days remaining before birthday in php [duplicate]
- How to get time difference in minutes in PHP
- How can I compare two dates in PHP?
- Add number of days to a date
- PHP DateTime::modify adding and subtracting months
- Accessing dates in PHP beyond 2038
- Date Difference in php on days? [duplicate]
- How to list all months between two dates
- PHP date() with timezone?
- Difference between 2 dates in seconds [duplicate]
- PHP convert date format dd/mm/yyyy => yyyy-mm-dd [duplicate]
- increment date by one month
- How to generate random date between two dates using php?
- PHP date format /Date(1365004652303-0500)/
- Print time in 15-minute increments between two times in the same day
- How to reformat date in PHP?
- Check for consecutive dates within a set and return as range
- Set timezone in PHP and MySQL
- PHP date() in foreign languages – e.g. Mar 25 Aoû 09 [duplicate]
- PHP date returning wrong Month on subtracting one month
- Get date range between two dates excluding weekends
- mysql – INSERT date range into date columns IF dates don’t overlap with existing ones
- PHP day of week numeric to day of week text
- date() method, “A non well formed numeric value encountered” does not want to format a date passed in $_POST
- MySQL, how to insert null dates
- Converting to date in PHP from yyyymmdd format
- Subtracting a certain number of hours, days, months or years from date
- How can I work with dates before 1900 in PHP?
- How do I convert an ISO8601 date to another format in PHP?