Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Dr J R Stockton Newsgroups: comp.lang.javascript Subject: Re: What is wrong with this If Else construction? Date: Tue, 27 Dec 2016 22:52:39 +0000 Organization: Home Lines: 32 Message-ID: References: <47744619-426f-4af1-8376-e2935a2570db@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="2ab51c815ee873e4425f07d63bdfdd95"; logging-data="15908"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TG+egaxArawwwmHV2hFodjWr/i9/QwfI=" User-Agent: Turnpike/6.05-S () Cancel-Lock: sha1:QryM6CfRnv9h49Dy20N2YWUsXfM= Xref: csiph.com comp.lang.javascript:32003 In comp.lang.javascript message <47744619-426f-4af1-8376-e2935a2570db@go oglegroups.com>, Mon, 26 Dec 2016 00:05:46, bart.smissaert@gmail.com posted: >New to JavaScript and trying to calculate the date of birth from an >Excel date, provided as an integer value (1 Jan 1900 = 1). Your inability is profound. Firstly, correct the Excel date (by +1 or -1, to allow for the idiot Californians not understanding the Gregorian calendar) as necessary; call that CXLD. Then consider CXLD = 42345 new Date(Date.UTC(1900, 0, CXLD)) which shows __me__ Tue Dec 08 2015 00:00:00 GMT+0000 (GMT Standard Time) The Date.UTC(...) eliminates concern about possible effects of Time Zone and Summer Time. In JavaScript, always use UTC within calendar-type calculations; use local date/time, *where*needed*, for I/O. -- (c) John Stockton, Surrey, UK. ¬@merlyn.demon.co.uk Turnpike v6.05 MIME. Merlyn Web Site < > - FAQish topics, acronyms, & links.