Please help, Date Format Error

Discussion in 'ASP .Net' started by Bernard, Jul 18, 2003.

  1. Bernard

    Bernard Guest

    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.
     
    Bernard, Jul 18, 2003
    #1
    1. Advertising

  2. 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.
    >
    >
    >
    >
    >.
    >
     
    Ravikanth[MVP], Jul 18, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frank Drebin

    Re: Weird date format. Please help?

    Frank Drebin, Aug 20, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    414
    S. Justin Gengo
    Aug 20, 2003
  2. Natty Gur

    Re: Weird date format. Please help?

    Natty Gur, Aug 20, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    358
    J Gao
    Aug 20, 2003
  3. Brian Candy
    Replies:
    2
    Views:
    1,194
    Janaka
    Feb 18, 2004
  4. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,332
    Michael Borgwardt
    May 30, 2004
  5. KK
    Replies:
    2
    Views:
    664
    Big Brian
    Oct 14, 2003
Loading...

Share This Page