Forum Moderators: coopster
you could not use the timestamp and use a date field and on access do the math to see if it is expired.
You could also store 2 dates. I don't really see why you want the purchase/registration date to be a timestamp but I assume you have a reason for that.
I would imagine you are using something like NOW() in your insert statement at present. You could do something like so
$yrplus1 = strtotime [ca.php.net]("+1 year");
that will put a unix timestamp into the variable $yrplus1 that is equal to 1 yr from that second. You can then pop that into a column as is or format it however you like. It is easy to just store the unix timestamp so it is easy to compare.
INSERT INTO table (expires) VALUES ('now'::date + INTERVAL '1 year');
INSERT INTO table (expires) VALUES (NOW() + INTERVAL '1 year');
MySQL:
INSERT INTO table (expires) VALUES (NOW() + INTERVAL 1 year);
(note that 'quotes' are required for psql and not allowed for mysql)
So was I, in a roundabout sort of way. Unless you are very careful with that data and the interaction with leap years there are some circumstances where some subscribers may receive 11 or 13 issues instead of the expected 12.