Click here to Skip to main content
15,171,993 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my date string is
June 17, 2014

i want to conver it in DateTime

string fromDate= "June 17, 2014";
string format = "MMM dd, yyyy";
 DateTime date = DateTime.ParseExact(fromDate, format, CultureInfo.InvariantCulture);

Error is

String was not recognized as a valid DateTime.

Change this:
string format = "MMM dd, yyyy";
string format = "MMMM dd, yyyy";
Yogesh Kumar Tyagi 18-Jun-14 5:41am
i change
from "MMM dd, yyyy" to "MMMM dd, yyyy".

Same error Through

String was not recognized as a valid DateTime.

Thanx Sir for Help i solve itself
Thanks7872 18-Jun-14 5:50am
Its impossible. With your given details this code is garunteed to be true. Check again.
Yogesh Kumar Tyagi 18-Jun-14 6:55am
yes, i checked Your code work

Thanks again.
DateTime fDate = DateTime.Parse(fromDate);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900