[thelist] ASP Date Manipulation

Casey Crookston casey.crookston at imibevcore.com
Tue Mar 19 09:25:01 CST 2002


I assume rs("date_completed") calls the database and retreives a stored
date? If so, I think you could just do a simple if then w/o your
pastdate variable :

if rs("date_completed") > date - 90 then

This just simply compares the stored date with todays today's date, to
which it subtracts 90 days.  If the stored date is greater then the date
90 days ago, the then if is fired.

HTH,

Casey







-----Original Message-----
From: Feingold Josh S [mailto:Josh.S.Feingold at irs.gov]
Sent: Tuesday, March 19, 2002 9:12 AM
To: 'thelist at lists.evolt.org'
Subject: [thelist] ASP Date Manipulation


This message is in MIME format. Since your mail reader does not
understand this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
I am trying to show only those records where the date is not older than
3 months from a date in the database.

Here is my code:

pastdate = DateAdd("m",-3,Now())  'pastdate is now three months ago

do while not rs.eof
    if rs("date_completed") > pastdate then  'if date in database is
newer than date three months ago
        response.write pastdate  'show the date
    end if
loop

I tried using both 2/01/02 and 2/01/02 in the database and neither makes
the date show.

Anyone know where I am wrong?

Thanks,
Josh
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list