Errors in displaying dates

Results 1 to 2 of 2

Thread: Errors in displaying dates

  1. #1
    Join Date
    Dec 1969

    Default Errors in displaying dates

    &#060;%<BR>Do While DateDiff("d", dtSelectedDate, dtSelectedDate2) &#062; 0 <BR> dtSelectedDate = DateAdd("d", 1, dtSelectedDate) <BR> Response.Write AddZero(Day(dtSelectedDate),2) & "/" & AddZero(Month(dtSelectedDate),2) & "/" & Year(dtSelectedDate) & "&#060;br/&#062;" <BR>Loop <BR>%&#062;<BR><BR>The above is the code I used. <BR>I select Start Date: 14/06/2002 ENd Date: 18/06/2002<BR>It comes out correct.<BR><BR>But if i select something like<BR>Start: 1/07/2002 End: 2/07/2002<BR>The number of dates that come out is 31.<BR>and it displays the following: <BR>08/01/2001<BR>09/01/2001<BR>10/01/2001<BR>11/01/2001<BR>.<BR>.<BR>. until<BR>05/02/2001<BR>06/02/2001<BR>07/02/2001 <BR><BR>And other errors like negative numbers and so on.

  2. #2
    Join Date
    Dec 1969

    Default Firstly.

    Don&#039;t start a new thread - continue using the one you were on.<BR><BR>Secondly, the code I wrote was off the top of my head, so there MAY be some errors. Did you check the syntax of those functions? Is it right?<BR><BR>The MAIN problem is probably because you are converting 02/07/2002 into a date. Which the "Americanized" scripting engine thinks is the 7th of Feb 2002. Try putting it in as "02 July 2002", and see if it makes the same mistake. Check out the article on about using international dates in scripting languages. Basically, you need to se the LCID to the correct value.<BR><BR>Read up on it, and don&#039;t start another new thread when you come back! Use this one! :)<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts