|
-
January 25th, 2010, 06:02 AM
#1
DateTime.ParseExact
Hi,
I want to parse data in string to a particular datetime format so that i am trying to use
DateTime.ParseExact ..
DateTime dateTime ;
DateTime.TryParseExact("10/20/2009", "dd/MM/yyyy", CultureInfo.InvariantCulture,DateTimeStyles.None, out dateTime);
But i have got the following error
" The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar"
pls give a solution to parse the date..
-
January 25th, 2010, 06:16 AM
#2
Re: DateTime.ParseExact
 Originally Posted by meenus
Hi,
DateTime dateTime ;
DateTime.TryParseExact("10/20/2009", "dd/MM/yyyy", CultureInfo.InvariantCulture,DateTimeStyles.None, out dateTime);
I think the problem is that you're specifying "20" as the value for "MM" or the month. The Gregorian Calendar only has 12 months. Try switching those values around e.g. "20/10/2009" or "MM/dd/yyyy"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|