Results 1 to 3 of 3

Thread: [RESOLVED] String was not recognized as a valid DateTime.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    91

    Resolved [RESOLVED] String was not recognized as a valid DateTime.

    Hai

    i am working with Windows applications in c#. i am working with Dates for my application. when i changed the settings in the machine to canada i am getting an error "String was not recognized as a valid DateTime.".

    i am taking the data in DataView.There i can see the datecolumn with "21/03/06"

    But when i am filtering the row with "21/03/06" date it is showing the above error "String was not recognized as a valid DateTime."



    Please suggest me any solution if u have


    Thanks and Regards
    Vinay Kumar
    Last edited by kumar_1981; Jan 7th, 2007 at 08:25 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: String was not recognized as a valid DateTime.

    I would guess that Canada use M/dd/yyyy format, so that string represents the third day of twenty-first month, which is obviously not a valid date. You cannot convert a date to a string using one format then expect to convert it back using a different format.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    91

    Re: String was not recognized as a valid DateTime.

    Thank you for the suggestions

    i am converting the date to mm/dd/yy format


    Thanks and Regards
    Vinay Kumar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width