Please help, Date Format Error

  • Thread starter Thread starter Bernard
  • Start date Start date
B

Bernard

Hello,

Can someone please help me?



We have developed a asp.net application which is working fine on 4 other
computers. We have recently deplyed the application to the live environment
running windows 2000 service pack 4, .NET v1.1.



We continue to get the following error "Cast from string "18/07/2003" to
type 'Date' is not valid." as the date is dmy and not mdy. We tried to
change the server's regional settings to Australia. This did not fix the
problem. We then tried to reinstall the framework. Still no luck.



Is there some setting i have to change on the server or on the framework to
use dmy date format?

Below is an example of the asp.net source that is a corse of the problem.
Please note that it is working on other servers and the work effort to
change the code is not an option:



Public Sub deletepdf(ByVal serverpath As String)
Dim fd As System.IO.DirectoryInfo
Dim fsArray As System.IO.FileInfo()
Dim i As Integer

fd = New System.IO.DirectoryInfo(serverpath + "/Temp")
fsArray = fd.GetFiles()

For i = 0 To fsArray.Length - 1
If (CDate(Format(fsArray(i).CreationTime, "dd/MM/yyyy")) <
CDate(Format(Now(), "dd/MM/yyyy"))) Then
fsArray(i).Delete()
End If
Next i

End Sub



Please help me.



Regards,

Bernard.
 
Hi

First use the IsDate function to determine if date can be
converted to a date or time.

Ravikanth

-----Original Message-----
Hello,

Can someone please help me?



We have developed a asp.net application which is working fine on 4 other
computers. We have recently deplyed the application to the live environment
running windows 2000 service pack 4, .NET v1.1.



We continue to get the following error "Cast from string "18/07/2003" to
type 'Date' is not valid." as the date is dmy and not mdy. We tried to
change the server's regional settings to Australia. This did not fix the
problem. We then tried to reinstall the framework. Still no luck.



Is there some setting i have to change on the server or on the framework to
use dmy date format?

Below is an example of the asp.net source that is a corse of the problem.
Please note that it is working on other servers and the work effort to
change the code is not an option:



Public Sub deletepdf(ByVal serverpath As String)
Dim fd As System.IO.DirectoryInfo
Dim fsArray As System.IO.FileInfo()
Dim i As Integer

fd = New System.IO.DirectoryInfo(serverpath + "/Temp")
fsArray = fd.GetFiles()

For i = 0 To fsArray.Length - 1
If (CDate(Format(fsArray
(i).CreationTime, "dd/MM/yyyy")) <
 
Back
Top