personaly the ISO 8601 is a favourite source for standardised dates
the YYYY.MM.DD hh.mm.ss format has a few advantages
firstly it is a STANDARD it is well used, and its format is not imitated by
people (yankees) .... stands back and watches a NAPLAM fireball ascend into the
heavens.... who think that days are longer than months are longer than
years.
so there is little danger of confustion.
the real reason this standard comes in handy is the characters are arranged from
most significant to least.
so to tell if one date is before (less than) another you can do byte wise
comparison.
its been a while since i used MC , so if some perl sneaks in here, cut me some
slack.
function ischrono ( foo, bar)
repeat with i = 0 to the number of chars in foo
if (char i of foo > char i of bar ) return (false)
if (char i of foo < char i of bar ) return (true)
end repeat
# we ran out of chars and there was not determinable differance
return
end ischrono
if you are sorting large lists in interpreted languages CPU effiency is a
must. this format permits quick comparisons of date strings in many
environments.
If you know you are staying on UNIX or UNIX compatable platforms then you can
store the number of seconds into the epoch (and the epoch?) and compare them
directly. Rather confusing to users, but it makes algorithmic sense if many
comparisons and few displays are being done.
beware the y 10k bug!
=
this email brought to you by AT&T system V UNIX (tm)
"reach out and grep someone"
RE>
From: Gary Rathbone <[EMAIL PROTECTED]>
Subject: Re: International date format
Date: Tue, 06 Feb 2001 20:25:52 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
In-Reply-To: <[EMAIL PROTECTED]>
Sounds familiar. Basically I ...
put the date into tdate
set the itemdel to "/"
put item 1 of tdate into tmonth
put item 2 of tdate into tday
put item 3 of tdate into tyear
put tday&"/"&tmonth&"/"&tyear into tdateout
or
convert the time to dateItems
this gives a comma separated list of items which are
year,month,day,hour,minute,second,day of week
You can then build you own date format. As far as I know altering the date
format in the Control Panels doesn't alter the way that Metacard reads the
date.
Just for your info the "Sunday Times Newspaper" had an article on date
formats recently, citing numerous 'standard' formats for different countries
and industries.
I can't remember who said "Standards are the backbone of computing... every
company should have their own." Bu they had a point.
Regards
Gary Rathbone
-
Robin-David Hammond
KPL
25-8D Van Zant
Norwalk CONN USA
Gerrold's Laws of Infernal Dynamics:
(1) An object in motion will always be headed in the wrong
direction.
(2) An object at rest will always be in the wrong place.
(3) The energy required to change either one of these states
will always be more than you wish to expend, but never so
much as to make the task totally impossible.
Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.