Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Please help, Date Format Error

Reply
Thread Tools

Please help, Date Format Error

 
 
Bernard
Guest
Posts: n/a
 
      07-18-2003
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.




 
Reply With Quote
 
 
 
 
Ravikanth[MVP]
Guest
Posts: n/a
 
      07-18-2003
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")) <
>CDate(Format(Now(), "dd/MM/yyyy"))) Then
> fsArray(i).Delete()
> End If
> Next i
>
>End Sub
>
>
>
>Please help me.
>
>
>
>Regards,
>
>Bernard.
>
>
>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Date Format - best way of converting a string into a date format Brian Candy ASP .Net 2 02-18-2004 02:13 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments