|
Posted by Oli Filth on 01/14/06 05:20
john.d.mann@sbcglobal.net said the following on 13/01/2006 18:34:
> VS wrote:
>
>> john.d.mann@sbcglobal.net wrote:
>>
>>> lwoods wrote:
>>>
>>>> I want to calculate and display the 'mm/dd/yyyy' that is 10 years
>>>> earlier than today.
>>>>
>>> // configuration
>>> $date = '01/01/2006';
>>> $offset = '-10';
>>> $date_glue = '/';
>>>
>>> // implementation
>>> $temp = explode($date_glue, $date);
>>> $temp[2] = $temp[2] + $offset;
>>> $date = implode ($date_glue, $date);
>>> echo $date;
>>
>>
>>
>> That technique only works for some date calculations.
>>
>> Try to take off 10 days during the first 10 days of the month or 10
>> months between Jan and October and you'll get strange results.
>>
>
> Well, sure, but he was only asking about the year hehe. For the day or
> month, a more advanced version would be required.
>
How about 29/02/2004?
--
Oli
Navigation:
[Reply to this message]
|