Your problem appears to be one of input interpretation.

If the date entered is 1 dec 2003, it converts to 01/12/2003
In this case, dd/mm/yy input and output.

if the daye entered is 1/12/2003, it converts to 12/1/2003
In this case you entered 1 Dec but the date was translated into 12 
Jan.  Your intent was dd/mm/yyyy but the systems' intent was 
mm/dd/yyyy.

In cases where the interpretation of mm/dd/yyyy is not possible 
(e.g., 1 Dec 03, 25/12/2003, etc) the functions work.  Otherwise the 
misinterpretation mm/dd/yyyy for dd/mm/yyyy takes over, 
giving 'confusing' results.


The way I see it, you can either anticipate the mm/dd/yyyy input 
format when only numbers are present or you can force a culture 
change to a culture where dd/mm/yyyy is typical.


Luck,


--- In [EMAIL PROTECTED], "pfrenchy" 
<[EMAIL PROTECTED]> wrote:
> having problems formating dates please help been working and 
reading for days trying to fix this. With certain dates month and 
day get reversed. I have no control over 2003win server global 
settings
> 
> I made an html page to show problem. In the page copy and past the 
dates into left box and click right box for function to occur.
> 
> 
> 
> To test page just copy this code into notepad and save as what 
ever you want to call page.html
> 
> 
> 
> Here is the code
> 
> 
> 
> code begin----------------->
> 
> <html>
> 
> <head>
> <meta http-equiv="Content-Type" content="text/html; 
charset=windows-1252">
> <title>New Page 1</title>
> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
> <meta name="ProgId" content="FrontPage.Editor.Document">
> <script Language="VBScript">
> Function ExaminationDate_onblur()
> 
>  Set theForm = document.DriverCert
>  Dim strdtDate
>  Dim strYear
>  Dim strDay
>  Dim strMonth
>  Dim strFinalDate
>  
>  If ((theForm.ExaminationDate.value)<> "") Then
>  
>   strdtDate = (theForm.ExaminationDate.value)
> 
>     varDate = FormatDateTime(strdtDate, [dddd/mmmm/yyyy])
> 'Extract the year
> strYear = year(varDate)
> 
> 'Extract the month and then make sure it has 2 digits using the 
len function
> strMonth = month(varDate)
> lenMonth = len(strMonth)
>    If lenMonth = 1 Then
>       strMonth = "0" & strMonth
>    end if
> 
> 'Extract the day and then make sure it has 2 digits using the len 
function
> strDay = day(varDate)
> lenDay = len(strDay)
>    If lenDay = 1 Then
>       strDay = "0" & strDay
>    end if
> 
> 'Now put it all together in a nice little format
> strFinalDate = strDay & "/" & strMonth & "/" & strYear
>   
>      theForm.CertificationExpiry.value = strFinalDate
> 
>  end if
>   
> end Function
> Function CertificationExpiry_onblur()
> 
>  Set theForm = document.DriverCert
>  Dim strdtDate
>  Dim strYear
>  Dim strDay
>  Dim strMonth
>  Dim strFinalDate
>  
>  If ((theForm.ExaminationDate.value)<> "") Then
>   
>   strdtDate = (theForm.ExaminationDate.value)
> 
>     varDate = FormatDateTime(strdtDate, [dddd/mmmm/yyyy])
> 'Extract the year
> strYear = year(varDate)
> 
> 'Extract the month and then make sure it has 2 digits using the 
len function
> strMonth = month(varDate)
> lenMonth = len(strMonth)
>    If lenMonth = 1 Then
>       'strMonth = "0" & strMonth
>    end if
> 
> 'Extract the day and then make sure it has 2 digits using the len 
function
> strDay = day(varDate)
> lenDay = len(strDay)
>    If lenDay = 1 Then
>       'strDay = "0" & strDay
>    end if
> 
> 'Now put it all together in a nice little format
> strFinalDate = strDay & "/" & strMonth & "/" & strYear  
>      theForm.CertificationExpiry.value = strFinalDate
> 
>  end if
>  
> end Function
> 
> </script>
> </head>
> 
> <body>
> 
> <form method="POST" action="--WEBBOT-SELF--" name="DriverCert">
>  <!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-
Format="TEXT/CSV" S-Label-Fields="TRUE" -->
>  &nbsp;<p align="center">Enter these test values notice with 
certain dates 
>  month and day get reversed<br></p>
>  <table cellpadding="0" cellspacing="0" width="658" height="73">
>   <!-- MSTableType="layout" -->
>   <tr>
>    <td width="329" height="73" valign="top">date formats 
dd/mm/yyyy<p>01/02/2003<br>02/02/2003<br>03/02/2003<br>04/02/2003<br>
05/02/2003<br>06/02/2003<br>07/02/2003<br>08/02/2003<br>09/02/2003<br
>
>  
10/02/2003<br>11/02/2003<br>12/02/2003<br>13/02/2003<br>14/02/2003</t
d>
>    <td width="329" height="73" valign="top">date formats 
dd/mm/yyyy<p>01/12/2003<br>02/11/2003<br>03/10/2003<br>04/09/2003<br>
05/08/2003<br>06/07/2003<br>07/06/2003<br>08/05/2003<br>09/04/2003<br
>
>  10/03/2003<br>11/02/2003<br>12/01/2003<br>&nbsp;</p>
>    <p>&nbsp;</td>
>   </tr>
>  </table>
>  <p>&nbsp;enter date here&gt;&gt;<input type="text" 
name="ExaminationDate" size="20">&nbsp; 
>  click here to make onblur occure &gt;&gt;<input type="text" 
name="CertificationExpiry" size="20"> </p>
> </form>
> 
> </body>
> 
> </html>
> 
> <-------------code end
> 
> 
> [Non-text portions of this message have been removed]








------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to