In comp.lang.javascript message <46e48ee1$0$5075$
>, Mon, 10 Sep 2007 02:23:11, ASM <
valid> posted:
>En réponse à Dr J R Stockton qui écrivit, en date du : 8/09/07 22:36,
>le message suivant :
>> In comp.lang.javascript message <46e1e2e1$0$25941$
>> r>, Sat, 8 Sep 2007 01:44:50, ASM <
>> valid> posted:
>>> // time spent since 1970 for user's day
>> No, that would mean 86400 seconds for the start of 1971-01-02 local.
>> You mean "time in milliseconds since 1970-01-01 00:00:00 UTC ..."
>
>OK, thanks for the precision.
You do, after all, seem to be of the country in which BIPM and BIH and
IERS reside ... . But many in the obtuser parts of the world ignore the
difference, and suffer, and cause others to suffer too.
>>> user_day = Date.parse(user_day);
>> Initially, user_day was a Date Object; Date.parse requires a String, so
>> implicit conversion is needed;
>
>?? Firefox's Errors consol didn't tell me that was wrong.
It's valid. It's as valid as going from Paris to Versailles via Monaco.
Another tip for speed : the UTC functions are considerably faster than
the non-UTC ones; only use non-UTC when handling actual date/time,
orneeding to respect time zones or Summer Time.
>I thought that new Date() returned a string, no?
No. It returns a Date Object, which holds an IEEE Double of
milliseconds from epoch and has several Methods. One of those,
toString, is used by default if the context demands a string.
>> Date.parse will then convert back (and
>> would get it wrong for most of the First Century AD).
>
>I hope there will be no meeting planed at this time
But it should be considered when coding for the Date of Easter!
>> user_day = +user_day // will convert from Date Object to Number,
>> // reliably and rapidly.
>
>You're not wrong.
>but isn't automatically converted by the condition (day_user>0) ?
It would be; but IIRC it would ALSO be converted elsewhere in the code.
If when assigning to a variable it is the numeric value which matters,
assign a Number. Unary + will do that.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
For news:borland.*, use their server newsgroups.borland.com ; but first read
Guidelines <URL:http://www.borland.com/newsgroups/guide.html> ff. with care.