Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Mixed up dates...

Posted 26 Jun 2002 15:16:11
1
has voted
26 Jun 2002 15:16:11 David Behan posted:
A wee problem with a function for removing unverified email addresses from a mailing list after x amount of days. Here is the scenario:

<b>purge page:</b> finds out what the date to purge days from using the following code...

&lt;% PurgeDate = Date() - Application("ActivList_PURGE_DAYS" %&gt;

Only noticed the bug today when changing the purge days to 14 days from 7 days. For today, a 7 day purge gives the result 19/06/2002 and a 14 day purge gives 12/06/2002. After it gets this date it filters the database on unverified email address and where sign up date is less than or equal to the variable PurgeDate. Here is the SQL...

"SELECT COUNT (SUB_EMAIL) AS TotalPurge FROM TBL_SUBSCRIBERS WHERE SUB_VALIDATED = 'N' AND SUB_SIGNUP_DATE &lt;= #" & PurgeDate & "#"


<b>The Problem:</b> For the scenario above... 7 days is recognised in international date format and filters the database correctly. But for 14 days it is recognised as US date format and gets subscribers before 12/06/2002 which is 06 December 2002, which is incorrect. Do I need to set the LCID on each page to ensure they are always in the correct format. What is the value for Ireland?

Thanks for your help...


Dave

_________________________
David Behan - www.site-manager.com/af.asp?a=11&l=1tds9p6x2

Replies

Replied 26 Jun 2002 17:14:20
26 Jun 2002 17:14:20 aegis kleais replied:
When messing with the date I find that the following occurs:

06/31/2002 is seen as a valid date.
31/06/2002 is seen as a valid date (because ASP will assume now that you mean that the month comes second to the date)

However, if I do the following:

dtTheDate = Date()
dtTheDate = CDate(Date())

Then dtTheDate will be forced to be month/day/year. Thus whenever you do the subtraction in CDate() on both variables, the mathematics should stay the same.
Replied 27 Jun 2002 02:59:54
27 Jun 2002 02:59:54 Andrew Watson replied:
This all to do with your locale id and regional setup, if all is in line then dates should function ok, i used to do al sorts to flip dates around and stuff, but it makes sense now.........<img src=../images/dmxzone/forum/icon_smile_question.gif border=0 align=middle>

:: Son, im Thirty.... ::
Replied 27 Jun 2002 13:54:34
27 Jun 2002 13:54:34 David Behan replied:
Leed,

I set the LCID = 1033 and that seems to have sorted the problem. Cheers.

Dave

_________________________
David Behan - www.site-manager.com/af.asp?a=11&l=1tds9p6x2

Reply to this topic