Please help, Date Format Error

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.
 
R

Ravikanth[MVP]

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")) <
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top