Date formats around the world
sarah.reichelt at gmail.com
Sun Nov 29 03:17:46 CST 2009
On Sun, Nov 29, 2009 at 8:16 AM, Bill Vlahos <bvlahos at mac.com> wrote:
> How do folks deal with storing dates when the formats around the world vary so much?
> Table below is for different countries according to Mac OS 10.6.2
> Australia 05/01/2009 5/01/09
> Canada 2009-01-05 09-01-05
> Hong Kong 5 Jan 2009 05/01/2009
> India 05-Jan-2009 05/01/09
> Jamaica Jan 5, 2009 1/5/09
> South Africa 05 Jan 2009 2009/01/05
> United States Jan 5, 2009 1/5/09
> A date string in one country isn't a date in a different country. How do you make them consistent if the user changes the formatting options?
If you just need the date and not the time, then storing "the English
date" will give you the date in a consistent format. Then you can
convert this to "system date" before displaying.
BUT.... if you need time as well, then you run into problems,
especially if these date-times need to be transferred across time
You can use the seconds, but they refer to a particular second in time
and the date & time they convert back to depend on the time zone set
in the computer doing the conversion.
To test this, get the seconds, store that number somewhere and convert
it to date and time.
Now change the time zone of your computer and do the conversion again
from the same number of seconds. You will get not get the same time
returned, you will get the time it was in the second time zone when
you got the seconds.
This makes using "the seconds" useless if you need to know when things
happened in a different time zone. I ran into this problem when
running kiosks in numerous time zones. If there was a problem, I
needed to know the time at the remote machine, not the time it was at
my machine when the problem occurred.
Using "the internet date" helps a bit because you then get the time
zone of the original event. You can convert this to your time zone or
use it to read the time in the original time zone. But the internet
date does not support daylight savings time (unless it has improved
since I last tested).
My solution in the end was to convert all date & times to my own time
stamp format: YYYYMMDDHHMMSS
This doesn't store any time zone data, but it gives me complete
control over the date & time stored. To manipulate this data, I use
"seconds" as an intermediate format, which works fine on a single
computer - it just gives problems when transferring between computers
in different zones.
BTW, I have been campaigning for a new time format called "the
universal seconds" where the same number would always translate to the
same date & time regardless of time zone.
If you feel this would be useful, please vote for
More information about the use-livecode