Wednesday, June 21, 2006

The International Culprit: Dates!!!

As the Alpha Testers in England and Portugal know, the current version of Pocket Pollster will not run properly on their computers. Today I found out at least one of the reasons why. It's the handling of the dates.

Here in Canada (and the U.S.) June 21, 2006 is stored as "06/21/2006". But in a country like England, it's stored as "21/06/2006". So when Pocket Pollster is running on a computer in England and sees "06/21/2006" it thinks "The 6th day of the 21st month". And then kicks out an error!

This is a little more tricky to resolve than one might think at first glance because we have to be sure that a file created in England can be properly viewed & used in the U.S. and vice-versa. But at least the error is now tracked down and obvious. I just have to find a solution that works for every situation.

2 comments:

Anonymous said...

Hello Robert Steve from UK here. I seem to remenber having the same problem with one of our Delphi database when I move to the states.

I now use MYSql and the date is stored in the table as 2004-10-04 but when displayed in a DBEdit it shows 4/10/04. There are no properties to change to UK / US format so I am presuming windows is intepreting the date and displaying accordingly.

If you are hard coding the dates this may be different.

Hope this is of help.

SteveW

Robert W. said...

Steve,

The problem has to do with the fact that I was converting (and then saving) dates from the DateTime format to the string format using the de facto format on my development machine. This is effectively en-US (English United States). But when you fellows over in Europe tried to read such dates, any with a day > 12 was failing.

So now I'm going to use a universal date format, as described here: http://msdn2.microsoft.com/en-us/az4se3k1.aspx (the ISO 8601 version).

Thanks for your feedback!