G
Guest
My app runs perfectly when run in Canada or the U.S. But others are
experiencing problems. So I switched my computer to the UK culture and
immediately saw a problem. This line was failing:
Convert.ChangeType(newdate, propType, null);
where propType = System.DateTime
It would only fail for dates like this: May 18, 2006 = 5/18/2006 in
US/Canadian format.
So I changed it to this:
Convert.ChangeType(newdate, propType, CultureInfo.InvariantCulture)
and this *seems* to have resolved the problem. But then I got to wondering:
What happens if a data file is created in England, where the format is
dd/mm/yyyy and opened on a US/Canadian computer where the format is
mm/dd/yyyy ?
Put another way, I'm looking for suggestions on best practices for handling
dates internationally. Is there a simple dotNet way to handle/store dates?
experiencing problems. So I switched my computer to the UK culture and
immediately saw a problem. This line was failing:
Convert.ChangeType(newdate, propType, null);
where propType = System.DateTime
It would only fail for dates like this: May 18, 2006 = 5/18/2006 in
US/Canadian format.
So I changed it to this:
Convert.ChangeType(newdate, propType, CultureInfo.InvariantCulture)
and this *seems* to have resolved the problem. But then I got to wondering:
What happens if a data file is created in England, where the format is
dd/mm/yyyy and opened on a US/Canadian computer where the format is
mm/dd/yyyy ?
Put another way, I'm looking for suggestions on best practices for handling
dates internationally. Is there a simple dotNet way to handle/store dates?