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


Groups > comp.lang.javascript > #9327

Re: JavaScript: Trouble with switch Syntax

From Dr J R Stockton <reply1150@merlyn.demon.co.uk>
Newsgroups comp.lang.javascript
Subject Re: JavaScript: Trouble with switch Syntax
Date 2011-12-16 21:28 +0000
Organization Home
Message-ID <0Y0i$$HCg76OFwkx@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <ug4ie75gitc6gc9rsse94i0slcpumt1pg0@4ax.com> <9ksmgfF7pkU1@mid.uni-berlin.de> <omlie7tv013gm2b3861rlmujovp694s7cd@4ax.com>

Show all headers | View raw


In comp.lang.javascript message <omlie7tv013gm2b3861rlmujovp694s7cd@4ax.
com>, Wed, 14 Dec 2011 18:11:25, Gene Wirchenko <genew@ocis.net> posted:

>     Close.  I did not have any break statements, because I was
>returning out of each case.  It is the main part of a routine for
>determining the number of days in a month.

function DiM(Y, M) { // M = 1..12
  return new Date(Y, M, 0).getDate() }

  return new Date(Date.UTC(Y, M, 0)).getUTCDate() // may be faster.

For another way, read about Zeller's Congruence; his relevant papers are
on my site.

For speed, try the codes in my  js-date3.htm#ML  - a button is provided.

-- 
 (c) John Stockton, nr London, UK.    ?@merlyn.demon.co.uk     Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

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


Thread

JavaScript: Trouble with switch Syntax Gene Wirchenko <genew@ocis.net> - 2011-12-14 13:23 -0800
  Re: JavaScript: Trouble with switch Syntax Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-14 23:32 +0100
    Re: JavaScript: Trouble with switch Syntax Tim Streater <timstreater@greenbee.net> - 2011-12-14 22:39 +0000
    Re: JavaScript: Trouble with switch Syntax Gene Wirchenko <genew@ocis.net> - 2011-12-14 18:11 -0800
      Re: JavaScript: Trouble with switch Syntax Dr J R Stockton <reply1150@merlyn.demon.co.uk> - 2011-12-16 21:28 +0000
  Re: JavaScript: Trouble with switch Syntax "Aaron Sawyer" <aaron.sawyer@deltaware.com> - 2011-12-14 18:58 -0400
    Re: JavaScript: Trouble with switch Syntax Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-15 00:42 +0100
      Re: JavaScript: Trouble with switch Syntax Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-15 01:06 +0100
    Re: JavaScript: Trouble with switch Syntax Gene Wirchenko <genew@ocis.net> - 2011-12-14 18:09 -0800
      Re: JavaScript: Trouble with switch Syntax Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2011-12-15 18:33 +1100

csiph-web