Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
string strHijdt ="29-02-1435";
DateTime hdt = DateTime.ParseExact(strHijdt, "dd/MMM/yyyy HH:MI24",CultureInfo.InvariantCulture);

Getting error while converting string("29-02-1435") to datetime
Posted
Comments
ridoy 9-Dec-13 2:07am    
use DateTime.TryParse()

1 solution

It's quite obvious that the data and format don't match at all. Besides, I am not sure you can support the year of 1435 (if this is the year). Probably, you mean Islamic Calendar, Hijri: http://en.wikipedia.org/wiki/Arabic_calendar[^].

Then, you should use the very special class, this one: http://msdn.microsoft.com/en-us/library/system.globalization.hijricalendar%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

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