Current date minus 4 month?

date, php

Solution

You can use `strtotime` in PHP:

$date = strtotime('2012-05-01 -4 months');

This article will help you.

Problem

I have date in this format (YYYYMM): ``` 201201 // Gen, 2012 201202 // Feb, 2012 201203 // ecc ``` Let's say from 201203 I want to subtract 4 months. I can't do `201203 - 4` because it's = `201199` `201203 - 4` should output `201111` (Nov, 2011) Maybe i should convert my string to a date and then pass it to strtotime with -4 month? Any suggest ?

Original source

Related problems