JRS: In article <3f**********************@news.euronet.nl>, seen in
news:comp.lang.javascript, Janwillem Borleffs <jw@jwscripts.com> posted
at Tue, 21 Oct 2003 18:02:22 :-
"Christopher Benson-Manica" <at***@nospam.cyberspace.org> wrote in message
news:bn**********@chessie.cirr.com... What would be the best way to convert a month number to its corresponding
string? I.e, 3 -> 'March'. Is there a builtin function or must I use a
lookup table or something?
Just use an array, e.g.:
var months = ['January', 'February', ....etc]
and then:
var monthString = months[new Date().getMonth()];
That array will give April for the index 3. The OP, starting with the
conventional number for the month, must either subtract 1 or add a dummy
zeroth month : ['', 'Janu... .
The code given is correct, but for a different question.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.