Click to See Complete Forum and Search --> : older than 14 days delete


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?

gerjan
07-03-2003, 04:57 AM
Hi,

I now made a DATE-field in Access.
When I read this out, it's like this:

27-7-2003

Now I heard that you can convert this date to the number of days from the year 0 ? That would solve the whole problem.

gerjan
07-04-2003, 05:07 AM
Ok, I'm almost there:

I've just one (I think it's a simple, but hard to explain) question.

This works fine:

date2 = #07/06/2003 09.00#
intDagactiviteit=DateDiff("d",#01/01/2002 09.00#,date2)
response.write intDagactiviteit &"<br><br>"

Now I want to get date2 from a string.
The following I'm getting from a form:

dateday = request.form("dateday")
datemonth = request.form("datemonth")
dateyear = request.form("dateyear")

So the main question is how can I put these values in date2 ?

gerjan
07-04-2003, 09:35 AM
Thank you Dave, problem solved :)