I have a date format conversion problem that I just can't find a solution for.
Here is the code snippet I'm using :
CultureInfo culture = new CultureInfo("en-us");
DateTime rate_dt = Convert.ToDateTime(txtStartDate.Text.ToString(),culture);
When I run the program, I enter "19-May-2008" in txtStartDate.
Unfortunately, the conversion always produces a rate_dt value of '19-05-2008 00:00:00'.
This format causes massive headaches for us. What I need is for rate_dt to contain either '05-19-2008 00:00:00' or '2008-05-19 00:00:00'.
I have tried running the code under every available Date format in my Regional Settings section, but nothing seems to work.
Anybody have any advice?
Here is the code snippet I'm using :
CultureInfo culture = new CultureInfo("en-us");
DateTime rate_dt = Convert.ToDateTime(txtStartDate.Text.ToString(),culture);
When I run the program, I enter "19-May-2008" in txtStartDate.
Unfortunately, the conversion always produces a rate_dt value of '19-05-2008 00:00:00'.
This format causes massive headaches for us. What I need is for rate_dt to contain either '05-19-2008 00:00:00' or '2008-05-19 00:00:00'.
I have tried running the code under every available Date format in my Regional Settings section, but nothing seems to work.
Anybody have any advice?