5
Answers

Problem with DateTime Format

try abc

try abc

15y
6.1k
1
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}
Answers (5)