Welcome Guest, Not a member yet? Register   Sign In
Date subtraction
#1

[eluser]ilSignorCarlo[/eluser]
Hi,
I need to perform some "simple" operations on dates, for example: getting the distance in days between two dates, or between now and a date in the past.

Code:
$previous_date = '2009-07-03';

// time() actually prints 2009-07-04

echo date('d', (time() - strtotime($previous_date));

This prints 02, but I'm not sure what it is. I mean, if it represents days, it should be 01.
Where am I wrong?

Thanks.


Messages In This Thread
Date subtraction - by El Forum - 07-04-2009, 09:08 AM
Date subtraction - by El Forum - 07-04-2009, 09:10 AM
Date subtraction - by El Forum - 07-04-2009, 09:35 AM
Date subtraction - by El Forum - 07-04-2009, 11:08 AM
Date subtraction - by El Forum - 07-04-2009, 11:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB