I am having difficulty with different date formats. I am having a web application created using asp.net c#. I have used JQuery Calendar control which shows date along-with time.
I am then parsing this date using DateTime.Parse(). If the server is set with indian date format then the application generates conversion error “String was not recognized as a valid DateTime.”
Is there a way to convert any date format into MM/DD/YYYY format along with time?
I know i can use DateTime.ParseExact() but again it will stuck with a particular format.
Any help is greatly appreciated.
Thanks for sharing you wisdom.
You can replace en-US by hi-IN for Hindi Date or as per you like. please follow link. for Culture Info.
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=vs.80).aspx
If you are unsure of Culture then use below line.
reference here http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx
Other Method you can use is.