Hello All,
Currntly i am working on a One database application..there is date Format setting for User to change the Date format Withing Application. It is {MM/dd/yyyy} Or (dd/MM/yyyy). Only this two format is allowed through out the application. I am storing every date from applicaiton to database in "MM/dd/yyyy" format. and when retriving i am displying in the format choosen by user in Application.. Ites Works fine on my Pc. but when i installed it in client pc it gives a Errorr stating"String was not recognized as a Valid Datetime".. Does it related to CulterInfo.. ??? Currently My Pc's Currrnt Culture is "English(United States)".
If it related to it How to assign Datefromat and Culture Info.
I am Using the Following code to convert format of date
Convert.ToDateTime(_VardtFromDb).ToString(_VarDateFormat);
here,
_VardtFromDb comes form Database and it is in "MM/dd/yyyy" format
_VarDateFormat is the format specified by User . and it is one of (MM/dd/yyyy) Or {dd/MM/yyyy}
Loading


AlanRank #669 · 3.6K reputationPosted Aug 11, 2008, 6:18 AM EDT
Try using:
DateTime.ParseExact(_VardtFromDb, "MM/dd/yyyy",null).ToString(_VarDateFormat)
try abcRank #6,639 · 260 reputationPosted Aug 11, 2008, 9:06 PM EDT
Let me try this...
try abcRank #6,639 · 260 reputationPosted Aug 12, 2008, 4:23 AM EDT
Thank you very much
Ahmad Othman2 reputationPosted Apr 15, 2009, 10:41 AM EDT
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ar-sy", true); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ar-sy", true);try abcRank #6,639 · 260 reputationPosted May 26, 2009, 10:48 PM EDT