I really draw a space on this. I'm working on globalization, but DateTime seems to always return to the CurrentThread culture. I broke it into smaller steps, hoping to find my problem, but it starts to drive me crazy.
I have a text box with a date expressed as a string:
At this point, I want a DateTime, which in en-US I tried both:
DateTime dt3 = Convert.ToDateTime(dt2, us_culture); DateTime dt3 = DateTime.Parse(dt2, us_culture);
But both produce de-DE DateTimes. The motivation for asking this question is that the rest of the business logic will call dt2.toString () and result in an invalid date time string. I understand that I can change toString () as toString (us_culture), but I would prefer not to change the rest of the business logic to accommodate this change.
Is there a way to get a DateTime in a culture other than the CurrentThread culture?
Thanks for your time, I've been banging my head about this for too long.
source share