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

[eluser]garymardell[/eluser]
Code:
$previous_date = '2009-07-03';
// time() actually prints 2009-07-04
$diff = time() - strtotime($previous_date);
echo floor(($diff / (60 * 60 * 24)));

Not saying this is the best way to do it, just made your code example work.


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