Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22373

Re: Date Conversion ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject Re: Date Conversion ?
Date Sun, 22 Dec 2013 09:52:40 -0700
Lines 46
Message-ID <bhojmuFi41U1@mid.individual.net> (permalink)
References <bh9en6Foh76U1@mid.individual.net> <j5A+FiEA$JsSFwlR@invalid.uk.co.demon.merlyn.invalid> <bhckeoFed4lU1@mid.individual.net> <K5f01p0$U1sSFwA4@invalid.uk.co.demon.merlyn.invalid> <bhjavfFre0kU1@mid.individual.net> <RmsCCZj0zftSFwL8@invalid.uk.co.demon.merlyn.invalid>
X-Trace individual.net U19YEiY+EE8Q5udAh9kIzQDgnMujD8YeYYmducQNGn3/5vKrDi
Cancel-Lock sha1:zQaLNvDTlN1NkVkFhCI+N5B9CpE=
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
X-RFC2646 Format=Flowed; Original
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
Xref csiph.com comp.lang.javascript:22373

Show key headers only | View raw


Dr Stockton said:

> JJ is inept. That function accepts dates before and after the end of the
> month named.  Date checking is in the newsgroup FAQ, and on my Web site.
> Form numbers for Y M' D, use nD = new Date(Date.UTC(Y, M', D)), and
> check whether nD.getUTCMonth() agrees with M'.  IIRC, that method fails
> for the end of February in Year Zero.  That's written from memory but is
> at least about right - it assumes the date field is assuredly of no more
> than two digits.
>
> The original article did not mention date checking; if it is machine-
> generated or already checked, there should be no need to check it again.
>
> Your code uses local date routines.  Those, in temperate countries, are
> substantially slower than UTC routines, since the date offset from GMT
> must be found and used.
>
> The Date Object is not needed, and its creation wastes time.  You can
> extract the Mmm dd yy fields, convert Mmm to a number mm as already
> described, and form  (yy*100+mm)*100+dd  which is easily seen to be an
> integer rising by at least 1 at each midnight.  But, if you do check
> with a Date Object, use its value for comparisons.
>
> I do not know whether it will be quicker to load those into an array and
> then use Math.(min|max).apply, or to just watch for increased or
> decreased values.  If speed matters to you, you should test that and
> report the result to enlighten the rest of us.
>
> Your code is not executable as posted, for at least two reasons.  Never
> allow your posting agent to line-wrap code.
>
> I'm still not clear as to whether you want to find the values or the
> positions or both for the earliest and latest dates.
>

Because of Christmas coming fast at us and because of guests arriving at my 
winter home in Arizona, I must wait a week or so before I delve deeper into 
your critique.

Bur, thank you for your analysis, and ...

Merry Christmas to you and all the folks here on this ng !

-Mel Smith

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Date Conversion ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-12-16 15:55 -0700
  Re: Date Conversion ? Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2013-12-17 01:06 +0100
    Re: Date Conversion ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-19 12:34 +0100
      Re: Date Conversion ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-20 22:29 +0100
        Re: Date Conversion ? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-23 10:00 -0200
  Re: Date Conversion ? JJ <duh@nah.meh> - 2013-12-17 07:06 +0700
    Re: Date Conversion ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-17 00:35 +0000
      Re: Date Conversion ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-12-16 18:16 -0700
      Re: Date Conversion ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-17 10:09 +0100
        Re: Date Conversion ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-17 17:02 +0000
        Re: Date Conversion ? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-18 19:14 +0000
          Re: Date Conversion ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-19 15:42 +0100
            Re: Date Conversion ? "Michael F. Stemper" <michael.stemper@gmail.com> - 2013-12-19 09:20 -0600
              Re: Date Conversion ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-20 10:04 +0100
      Re: Date Conversion ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-17 15:12 +0100
        Re: Date Conversion ? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-17 18:10 -0200
          Re: Date Conversion ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-17 21:42 +0100
    Re: Date Conversion ? Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2013-12-18 13:36 +0100
  Re: Date Conversion ? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-17 19:02 +0000
    Re: Date Conversion ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-12-17 20:51 -0700
      Re: Date Conversion ? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-19 20:21 +0000
        Re: Date Conversion ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-12-20 09:52 -0700
          Re: Date Conversion ? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-21 20:41 +0000
            Re: Date Conversion ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-12-22 09:52 -0700

csiph-web