How do I display dates in a format consistent with the user's computer?

T

ted

I see many sites that display a date in the format of 02/03/04. Which number
is the year, month and day? Who knows.

Is there a way for me to query the OS's date format and display a date
consistent with that format?

Thanks
 
M

Mark Parnell

Previously in alt.html said:
Is there a way for me to query the OS's date format and display a date
consistent with that format?

Yeah sure, check my OS settings. Why not change a few while you're
there?

IOW, no. It would be a massive security risk.
 
K

Karl Core

ted said:
I see many sites that display a date in the format of 02/03/04. Which
number is the year, month and day? Who knows.

Is there a way for me to query the OS's date format and display a date
consistent with that format?

You think the visitor doesn't know what day it is, and/ or cannot get that
from their own computer?
Are they coming to your site to find out what day it is, or are they coming
for a different reason?
 
G

Greg Schmidt

Well, I know that your example should be March 4, 2002, but many (who
have never had to write a routine to sort date strings) would disagree.
You think the visitor doesn't know what day it is, and/ or cannot get that
from their own computer?
Are they coming to your site to find out what day it is, or are they coming
for a different reason?

What about a travel site, where they are asking you to confirm your
itinerary? A bank confirming the date of a future bill payment? A
history site listing famous battles, a sports team's schedule, the date
on an archived press release. Many examples where the date shown is not
today's date.

I personally would prefer to see the date given as Dec 10, 2004 (or, if
space is really that critical, Dec10/04 fits into the same 8 chars as
the OP's example).
 
D

David Dorward

ted said:
I see many sites that display a date in the format of 02/03/04. Which
number is the year, month and day? Who knows.

2nd February 2004 leaves no room for misunderstanding (unless the user
doesn't read that language - in which case why are they reading the
document anyway? :)
 
N

Neal

I see many sites that display a date in the format of 02/03/04. Which
number
is the year, month and day? Who knows.

Is there a way for me to query the OS's date format and display a date
consistent with that format?

Never heard of a workable method. Best practice - state month explicitly,
state year in full form. Use your correct local format.

04 March 2002
March 4, 2002
etc.
 
B

BJ in Texas

ted wrote:
|| I see many sites that display a date in the format of
|| 02/03/04. Which number is the year, month and day? Who knows.
||
|| Is there a way for me to query the OS's date format and
|| display a date consistent with that format?
||
|| Thanks

Try 02 Mar 04 or 03 Feb 04, most can figure that out and it only
takes one more space.

BJ
 
S

steven

BJ in Texas said:
ted wrote:
|| I see many sites that display a date in the format of
|| 02/03/04. Which number is the year, month and day? Who knows.
||
|| Is there a way for me to query the OS's date format and
|| display a date consistent with that format?
||
|| Thanks

Try 02 Mar 04 or 03 Feb 04, most can figure that out and it only
takes one more space.

BJ

ISO8601: 2004-03-02

http://www.cl.cam.ac.uk/~mgk25/iso-time.html
http://www.saqqara.demon.co.uk/datefmt.htm
http://www.hermetic.ch/cal_stud/formats.htm
 
S

steven

Greg Schmidt said:
Well, I know that your example should be March 4, 2002, but many (who
have never had to write a routine to sort date strings) would disagree.

You do? I think it could be any one of
March 4, 2002
March 2, 2004
February 3, 2004.
What about a travel site, where they are asking you to confirm your
itinerary? A bank confirming the date of a future bill payment? A
history site listing famous battles, a sports team's schedule, the date
on an archived press release. Many examples where the date shown is not
today's date.

I personally would prefer to see the date given as Dec 10, 2004 (or, if
space is really that critical, Dec10/04 fits into the same 8 chars as
the OP's example).

How about ISO8601: 2004-03-02

http://www.cl.cam.ac.uk/~mgk25/iso-time.html
http://www.saqqara.demon.co.uk/datefmt.htm
http://www.hermetic.ch/cal_stud/formats.htm
 
N

Neal

steven:
Neal:

Like ISO8601, you mean?

Outside of technical uses, it's not particularly useful to the average
Joe. Average Joe has not read ISO 8601, and he wants a more human-readable
format than that. Also, there is no guarantee that 2004-12-10 cannot be
mistaken for October 12, 2004 by individuals unaware of the ISO standard.

Essentially, unless you and your reader both know a standard, the standard
is not worth using, especially if there's an even better way.
Nah. You don't want to do that.

Why? Is it ambiguous in the least? This method has the least chance of
being misinterpreted, slightly less even than the ISO standard.
 
D

Duende

While sitting in a puddle rf scribbled in the mud:
steven wrote

Only 4% of the worlds population would have thought this :)

Do you have documentation to backup that number?
 
R

rf

Duende said:
While sitting in a puddle rf scribbled in the mud:


Do you have documentation to backup that number?

Sorry, type there. I meant to say less than 5%. This is assuming that the
only people who use mdy are those in the U S of A.

On checking my windows regional settings I find that there are a few other
small countries that use mdy as well, Simbabwe, panama, swaziland, the
phillipines (not so small at 75 million). Adding all these in as well we
find that about 6.2% of the world use mdy. The rest use either ddmmyyyy or
yyyymmdd.

The raw numbers can be found here:

http://esa.un.org/unpp/
 
S

steven

I never thought of it, but you're absolutely right!

Sorry, type there. I meant to say less than 5%. This is assuming that the
only people who use mdy are those in the U S of A.

On checking my windows regional settings I find that there are a few other
small countries that use mdy as well, Simbabwe, panama, swaziland, the
phillipines (not so small at 75 million). Adding all these in as well we
find that about 6.2% of the world use mdy. The rest use either ddmmyyyy or
yyyymmdd.

The raw numbers can be found here:

http://esa.un.org/unpp/

Now that's an interesting site. I've been looking for this information for
ages. Thanks.
 
D

Duende

While sitting in a puddle rf scribbled in the mud:
Sorry, type there. I meant to say less than 5%. This is assuming that
the only people who use mdy are those in the U S of A.

On checking my windows regional settings I find that there are a few
other small countries that use mdy as well, Simbabwe, panama, swaziland,
the phillipines (not so small at 75 million). Adding all these in as
well we find that about 6.2% of the world use mdy. The rest use either
ddmmyyyy or yyyymmdd.

The raw numbers can be found here:

http://esa.un.org/unpp/

I use ddmmyy
 
S

steven

Neal said:
steven:

Outside of technical uses, it's not particularly useful to the average
Joe. Average Joe has not read ISO 8601, and he wants a more human-readable
format than that. Also, there is no guarantee that 2004-12-10 cannot be
mistaken for October 12, 2004 by individuals unaware of the ISO standard.

Essentially, unless you and your reader both know a standard, the standard
is not worth using, especially if there's an even better way.

That goes for every standard, and I'm trying to let the reader know.
Why? Is it ambiguous in the least? This method has the least chance of
being misinterpreted, slightly less even than the ISO standard.

It's also language-dependent. How about 9 srpen 2004 or listopad 15, 2002?
By gad! Listopad 15 looks more like a street address.
David noted that you have to know the language anyway to be able to read the
document. Suppose you get (lists of) dates from overseas contacts and you
have to merge them with your own information.
ISO8601 is language independent.
And talking of lists: if you sort ISO8601 dates alphabetically, they're
automagically sorted chronologically as well.
ISO8601 has a fixed length and is shorter than date formats which use the
month name in it. (yes, alright, "2 May 2004" is just as short, but that
goes just for 9 days a year).
 
S

steven

steven said:
That goes for every standard, and I'm trying to let the reader know.


It's also language-dependent. How about 9 srpen 2004 or listopad 15, 2002?
By gad! Listopad 15 looks more like a street address.
David noted that you have to know the language anyway to be able to read the
document. Suppose you get (lists of) dates from overseas contacts and you
have to merge them with your own information.
ISO8601 is language independent.
And talking of lists: if you sort ISO8601 dates alphabetically, they're
automagically sorted chronologically as well.
ISO8601 has a fixed length and is shorter than date formats which use the
month name in it. (yes, alright, "2 May 2004" is just as short, but that
goes just for 9 days a year).

BTW, I found srpen and listopad in Ronald Kyrmse's list of month names
(http://www.geocities.com/kyrmse/Mesemana_2.0.pdf), dated 2003-11-26 :)
 
S

steven

Duende said:
While sitting in a puddle rf scribbled in the mud:


I use ddmmyy

If everybody would have used ISO8601 there would never have been a Y2K
problem. Mind you, even with ISO8601 we'll have a Y10K problem, but I guess
that mankind will have other things on its mind before we reach that date.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top