Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98382 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75525 invoked from network); 2 Mar 2017 16:04:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2017 16:04:09 -0000 Authentication-Results: pb1.pair.com header.from=crocodile2u@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=crocodile2u@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.182 as permitted sender) X-PHP-List-Original-Sender: crocodile2u@gmail.com X-Host-Fingerprint: 209.85.217.182 mail-ua0-f182.google.com Received: from [209.85.217.182] ([209.85.217.182:36232] helo=mail-ua0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/A6-20342-87248B85 for ; Thu, 02 Mar 2017 11:04:09 -0500 Received: by mail-ua0-f182.google.com with SMTP id 72so82706311uaf.3 for ; Thu, 02 Mar 2017 08:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=0Y0T9e+2pdkhXzkyXC0oiTscPBIFokRnioz5/SYYdE4=; b=tpg2yJlFxscSiPggI2fPdqiJ0aX91fsYnMR/CxIGy2pjwBT1SOwZVNPB/0JVVHaQrC gsm9FWpVd66zqmn8ZvTIZiHVL+YZikHnZOjPGYSSuy+us+SzGv7qo46KeyuNsb5hupE8 dPwwf7mmEnMbhWrcPQx5lQzZuSKLSiLWRv0934/c1qh0HmqP5ETbQ2x1NZplMCMSRc83 W7aHo3bczvH+sLTLudh7eoeik3KgusiwGX+Vbz7EyXNMM4GOdy3zHBz+KejVl76VW6ka b37BFJGaYwLqgMeNlBg88NIgOG/7mcueYWBKsBO4kygfb7SRJ/5thcCiZSVoU1QHYlTv tLjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=0Y0T9e+2pdkhXzkyXC0oiTscPBIFokRnioz5/SYYdE4=; b=nkPLJyuly2Tsiid6SbR/DKAYiO/ktS0iOuG81r5VQ7hONNr6XFC7XEMpne+6Pim0di YVCpaIZ5fTpaMKSO3+9SqYHmwVRaJ42jGtH3GVxr0Mp/pP5XYLPNSvIGGUsOCCqupSEH cQG6p5KQ8PS+kjtbYtTEZ+N3oIyz0we9EenCQe72nD7JmCIMiHe053ZC0smVzICY2Gl9 9f0tA98149AVJlX/nJHO0jQ8J8gG6Aip1SsVgtBXrXWWIm4SZETtb5n9jecbUeRlkOwb POTj6wavSatK3bImfXkl1B2JkXWJwW2t+Q/21X1t4HcQluZU8/kDX3ScBtZ2GCgP5tyu B4vg== X-Gm-Message-State: AMke39nlRnup2w0NNBqxtLe8ljMSudWoGWGALHg5N4p1GBN/TGnnQxXYF2DUKW0tGYbAZvmSIJNbEZ/3DQAWGA== X-Received: by 10.31.6.73 with SMTP id 70mr3250825vkg.173.1488470645606; Thu, 02 Mar 2017 08:04:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 02 Mar 2017 16:03:55 +0000 Message-ID: To: Andreas Heigl , PHP Internals Content-Type: multipart/alternative; boundary=001a1143dc861712560549c1947b Subject: Re: [PHP-DEV] New constants in DateTime From: crocodile2u@gmail.com (Crocodile) --001a1143dc861712560549c1947b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Well, actually, that's a good reason for not having interval constants in the core. Still think though that SQL formats would be a nice addition ;-) On Thu, Mar 2, 2017 at 4:57 PM Andreas Heigl wrote: > > Am 02.03.17 um 16:46 schrieb Crocodile: > > While I agree with everything you're saying, I also think it could stil= l > be > > worth it to have those constants in core for the following reasons: > > > > 1. MINUTE, HOUR and DAY are particularly often used, 99.999% of the tim= e > in > > a context where it does not matter if a minute has 60 seconds or not, o= r > if > > a day has 24h or not. Particularly often used to specify cache lifetime= , > > for example. > IMO they then should be part of the caching (or whatever)-implementation > and not of DateTime. As *when* they are part of DateTime they will be > used in a DateTime-context *where they shouldn't be used*! > > > 2. It's surely easy to implement them in userland but that would requir= e > > either global constants or a class in userland specifically for that > > purpose. Both ways are easy, but these constants I see in virtually any > > project, so for me it would be handy to have them in DateTime. > > When you need them use a Constant-Class or create a composer package > that contains your constants and require that. > > https://3v4l.org/5MW7O > > That's much more extensible than having them in the core and needing to > maintain them for everyone=E2=80=A6 > > But as I said: just my 0.02=E2=82=AC > > Cheers > > Andreas > > > > But of course, I don't see it as a must-have, just as nice-to-have. > > > > Cheers, > > Victor > > > > On Thu, Mar 2, 2017 at 4:03 PM Andreas Heigl wrote: > > > >> Hi Victor. > >> > >> > >> Am 02.03.17 um 15:48 schrieb Crocodile: > >>> Hello internals, > >>> > >>> A similar question should have been asked already but I haven't found > >>> anything so far when googling: I think DateTime class should have the > >>> following constants in addition to those already existing: > >>> > >>> const SQL =3D "Y-m-d H:i:s"; > >>> const SQL_DATE =3D "Y-m-d"; > >>> const SQL_TIME =3D "H:i:s"; > >>> const SECOND =3D 1; > >>> const MINUTE =3D 60; > >> Not every minute has 60 seconds. > >>> const HOUR =3D 3600; > >> See above! > >>> const DAY =3D 86400; > >> Not every day has 86400 seconds. For one see the comment on MINUTE and > >> also there are days that have more or less than 24 hours (DST) > >> > >> Therefore I wouldn't want to see those constants (that are also very > >> easy to put up in userland - even though they aren't correct) in the > >> PHP-Core. > >> > >> And as the SQL-Constants are also easily to implement in userland I'm > >> not sure it makes to add them to the core=E2=80=A6 > >> > >> But that's just my 0.02=E2=82=AC > >> > >> Cheers > >> > >> Andreas > >> > >> > >> -- > >> ,,, > >> (o o) > >> +---------------------------------------------------------ooO-(_)-Ooo-= + > >> | Andreas Heigl = | > >> | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2= =B023'58" | > >> | http://andreas.heigl.org http://hei.gl/wiFKy7 = | > >> +---------------------------------------------------------------------= + > >> | http://hei.gl/root-ca = | > >> +---------------------------------------------------------------------= + > >> > >> -- > > Best regards, > > Victor Bolshov > > > > > -- > ,,, > (o o) > +---------------------------------------------------------ooO-(_)-Ooo-+ > | Andreas Heigl | > | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | > | http://andreas.heigl.org http://hei.gl/wiFKy7 | > +---------------------------------------------------------------------+ > | http://hei.gl/root-ca | > +---------------------------------------------------------------------+ > > -- Best regards, Victor Bolshov --001a1143dc861712560549c1947b--