gerjan
07-02-2003, 04:38 AM
I have some records in my DB and I want to delete them when they are older than 14 days.
When I add them to the DB I give them two kinds of date codes like:
20030702 and
02-07-2003
How can I check if an record is older than 14 days?
Tnx in advance!
p.s. First I thougt it is very simple
just like this.
add date is i.e.:
20030701
and datenow
20030702
20030702 - 20030701 = 1, so WILL NOT be deleted
Than the record stays.
But then I get a problem when it's a different month i.e.:
20030630
and datenow
20030702
20030702-20030630 = 72, so WILL be deleted.
Ofcourse it's not more than 14 days later.
There must be a way to do this right.
Anyone ideas?
When I add them to the DB I give them two kinds of date codes like:
20030702 and
02-07-2003
How can I check if an record is older than 14 days?
Tnx in advance!
p.s. First I thougt it is very simple
just like this.
add date is i.e.:
20030701
and datenow
20030702
20030702 - 20030701 = 1, so WILL NOT be deleted
Than the record stays.
But then I get a problem when it's a different month i.e.:
20030630
and datenow
20030702
20030702-20030630 = 72, so WILL be deleted.
Ofcourse it's not more than 14 days later.
There must be a way to do this right.
Anyone ideas?