Question
Procedure Confirmed with Comparing Dates
Trying to compare two dates, and there's so many ways I'm
just getting a bit
confused.
I have a date stored in my database in a timestamp field with this format:
2006-03-05 19:13:05
I have a term defined in months (in the database) of how long the account is
valid:
term: 12
I can now almost get the expired date, with this code, where $vDate is the
untouched date from my database, and $term is the term in months.
$blog2 = date("M jS Y",strtotime($vDate,'+'.$term.' Month'));
But it only increments the months, not the years.
Now, here's my problem:
I can create an array with expired and current dates, but then I have to
construct a moderately complex if/elseif statement to check year, then
month, then day.
Is there a better way? IE, can anybody think of a method in which I can
compare the dates more efficiently? I'm going in circles. Everytime I
think I've almost got it, I lose something.
Any suggestions?
TIA,
Jon
confused.
I have a date stored in my database in a timestamp field with this format:
2006-03-05 19:13:05
I have a term defined in months (in the database) of how long the account is
valid:
term: 12
I can now almost get the expired date, with this code, where $vDate is the
untouched date from my database, and $term is the term in months.
$blog2 = date("M jS Y",strtotime($vDate,'+'.$term.' Month'));
But it only increments the months, not the years.
Now, here's my problem:
I can create an array with expired and current dates, but then I have to
construct a moderately complex if/elseif statement to check year, then
month, then day.
Is there a better way? IE, can anybody think of a method in which I can
compare the dates more efficiently? I'm going in circles. Everytime I
think I've almost got it, I lose something.
Any suggestions?
TIA,
Jon