JRS: In article <8O********************@comcast.com>, dated Mon, 14 Mar
2005 21:18:22, seen in news:comp.lang.javascript, Randy Webb
<Hi************@aol.com> posted :
Dr John Stockton wrote:
JRS: In article <EO********************@comcast.com>, dated Sat, 12 Mar
2005 18:12:58, seen in news:comp.lang.javascript, Randy Webb
<Hi************@aol.com> posted :
Probably the simplest method would be a Julian type date
based on the current day of the year and the current year. Search the
comp.lang.javascript archives on how to do that.
That use of "Julian" is somewhat specific to the US computer industry;
the international standard term for that is "Ordinal Date". Julian Date
is rightly a daycount from Gregorian -4713-11-24 12:00:00 GMT.
Depends on which definition of "Julian" date you use, and how you
percieve the phrase "Julian *type*". Not a "Julian Date", but a "Julian
Type Date".
It is safer not to introduce "Julian" in conjunction with YYYY-DDD or
similar; why perpetrate an IBMism that conflicts with long established
usage throughout the world? I know of no definition of "Julian type
date" as such; but one would expect it to apply to one of JD, MJD, CJD,
CMJD, and similar - a day-count from a single base date fixed in
"history".
If one has files for each day, the simplest is IMHO to name them as
YYYYMMDD (MMDD if the same files are used on the same date each year).
If so inclined. But as long as the proper file can be determined for the
date, it doesn't matter.
Except that the simplest is less likely to have errors in
implementation; the obvious way to determine ordinal date is be finding
the days difference between now and Jan 1st --- and we have recently
been provided by two posters of a demonstration of how not to do that.
One should consider whether the change is to be at midnight user time,
midnight GMT (both easy) or at some other time.
It doesn't matter, as long as it happens in a reasonable manner to the
OP. Perhaps the most *sensible* time would be midnight user time.
Indeed; the OP should, however, consider the matter. Some other
midnight *might* be more fitting.
Ordinal date is not quite so easy; I don't recall it being discussed
here recently, but reading the FAQ should help.
"Ordinal Date", as you call it, wouldn't be that hard to determine, the
most difficult being Feb's days which is quite trivial.
Perhaps you have forgotten what the FAQ says on the subject?
Ordinal Date, which is the term used in ISO 8601, can be calculated from
Y M D by taking the difference of Date.UTC of Y M D & Y 0 0 and
dividing; it can be calculated from a Date Object by noting valueOf(),
setting Month and Date to 0, subtracting, dividing, *and rounding*. No
need to bother explicitly with the length of each month at all. Or one
can avoid Date completely by (after Meeus; cf. Zeller) :
K = 2 - (Y%4==0) // 2 - Leap, 1901-2099
N = Math.floor(275*M/9) - K*(M>2) + D - 30
Nevertheless, a Y M D -based URL is easier, especially as the author
will probably want to know at sight what date each page is for. Though
Y W D might gave advantages, if one week tends to resemble another.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.