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


Groups > comp.lang.php > #17594

Days until Christmas (was: its quiet here - test)

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Days until Christmas (was: its quiet here - test)
Date Thu, 26 Oct 2017 19:29:49 +0200
Organization solani.org
Lines 35
Message-ID <ost629$o1b$1@solani.org> (permalink)
References <osi15t$14b7$2@gioia.aioe.org> <ie7HB.22292$wT2.6774@fx22.iad> <59eef5e9$0$797$e4fe514c@news.xs4all.nl> <gLOHB.37370$Ov1.6569@fx30.iad> <59f1b002$0$818$e4fe514c@news.xs4all.nl> <7zoIB.22653$463.8426@fx13.iad>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1509038985 24619 eJwFwYEBwCAIA7CXxJWC5wiV/09Y4h+NHaATPj6aOorpZdQxASHeiaXOYj69rtiZc6GNh/oBOjoSMw== (26 Oct 2017 17:29:45 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 26 Oct 2017 17:29:45 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
X-NNTP-Posting-Host eJwFwYEBwDAEBMCVEP9inCL2H6F3OFR2OEHHYmdksj6nGPrwdYBbomXXQic8gVS8K16qkj8Y6xA8
In-Reply-To <7zoIB.22653$463.8426@fx13.iad>
X-User-ID eJwFwYkBwCAIA8CVDE8s44gl+4/gXTrBu4PJSKVkBc3iUR1C8Nv4vDydv9uOWT1s7UDjlMUDGp0QzA==
Cancel-Lock sha1:TR2tHc+2JjR/qx1ufObu7P3ywco=
Content-Language de-DE
Xref csiph.com comp.lang.php:17594

Show key headers only | View raw


On 26.10.2017 at 19:02, Mark Lloyd wrote:

> On 10/26/2017 04:51 AM, Luuk wrote:
> 
> [snip]
> 
>> LOLm where do you in this '62 days' consider those 25 hours?
> 
> Once I have the 2 times in seconds (now and later), I determine is DST
> (Damn Stupid Time, it really makes time calculations more complicated
> for no actual benefit) is active for each of them. This is done using
> the PHP date function; date('I', $time).
> 
> If DST is active later but not now, add the DST offset to the interval.
> 
> If DST is active now but not later, subtract the DST offset from the
> interval.
> 
> "DST offset" is usually 3600 (60*60 for "add 1 hour"), unless you live
> on Lord Howe Island (1800) or Troll Station, Antarctica (7200);
> 
> The interval is now ready to be converted to days by dividing by 86400.

That appears to be overly complicated.  Wouldn't

  (new DateTime('now'))
    ->diff(new DateTime('2017-12-25T00:00'))
    ->format('%a days until Christmas')

suffice?  Okay, that rounds down, and your solution rounds up, but that
could be catered to.

-- 
Christoph M. Becker

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


Thread

its quiet here - test bill <william@TechServSys.com> - 2017-10-22 07:58 -0400
  Re: its quiet here - test hah <hah@no.email.stupid.invalid> - 2017-10-22 15:31 -0500
    Re: its quiet here - test Luuk <luuk@invalid.lan> - 2017-10-24 10:12 +0200
      Re: its quiet here - test Mark Lloyd <not@mail.invalid> - 2017-10-24 17:01 -0500
        Re: its quiet here - test Luuk <luuk@invalid.lan> - 2017-10-26 11:51 +0200
          Re: its quiet here - test Mark Lloyd <not@mail.invalid> - 2017-10-26 12:02 -0500
            Days until Christmas (was: its quiet here - test) "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-10-26 19:29 +0200
              Re: Days until Christmas Mark Lloyd <not@mail.invalid> - 2017-10-26 17:56 -0500
                Re: Days until Christmas "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-10-27 01:38 +0200
                Re: Days until Christmas Mark Lloyd <not@mail.invalid> - 2017-10-26 20:48 -0500

csiph-web