Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98380 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72262 invoked from network); 2 Mar 2017 15:47:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2017 15:47:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=crocodile2u@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=crocodile2u@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.176 as permitted sender) X-PHP-List-Original-Sender: crocodile2u@gmail.com X-Host-Fingerprint: 209.85.217.176 mail-ua0-f176.google.com Received: from [209.85.217.176] ([209.85.217.176:35181] helo=mail-ua0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/06-20342-F7E38B85 for ; Thu, 02 Mar 2017 10:47:11 -0500 Received: by mail-ua0-f176.google.com with SMTP id q7so48846310uaf.2 for ; Thu, 02 Mar 2017 07:47:11 -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=P0OWW3ERDikrzWcO7/MZgFyYJRz0A5zJcnhk/pNB+1k=; b=kqg0PuQKDrN/Hsiyb7oJ/0qrPkwEY66ZNg4hVilVO+9Y9OMXSkqyXEC328BgoUWxgH +BaTeV8WAeAq6KhwBg7CkRN/hfDeAHAO4ax1RVFOANRn535lcv0b/tbL/5jGC4mKn8W3 7d0dxxNBpugiZ7cN325jP4MtBIIOu93cFhbO0F2281YC+crcgj92H7cC7fz7wF4ms4MM j0uAT8MYWOWOR3BXfUUlxBzByoORRAbe4AhUYZmXQhDgdOWIi9Q5unE3r2x3JOe0fdz0 9NWEFVlGmQux2O8Ym2CNP3NXR0ScQud0i1z/NfxELPXmKfGRMV3sdmxjQymkhYfJGmkd Iqow== 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=P0OWW3ERDikrzWcO7/MZgFyYJRz0A5zJcnhk/pNB+1k=; b=jtH7KKe1985twSHijmxh34qlCNqKC3T050RA7H5drTohcO92mgGhZHjVBhjW9jj9tC 76Zlc2BSX+ONSKZhdMSoUx54IzRgGuN0MEIAX5h24Ks5wCp3ahYV7QeJ0Y7d7yA2Qa1p 6xNVY9OMaz5H/jKo43OoYRf3RsiHVHQFyIx+ztrgoDGwaKH1JnaDpy+3vfBmhaZz2trF RL2hRFRF9K65hANf86BjqHZtzUQh50yBnKx/j0YQvmfYomAPbALX4+3GdCNS7ffdX+GD xK48Qh8abGHWyq7b18KFP7iEZb2spyxouAAT9piMjL4eGbdrGy+T3FtuCZtkaZqgHKXK 9upw== X-Gm-Message-State: AMke39kvL+rwfGKH6054WQ1aF94M8Zl8o5N8wQZSY/vgSGDJUEfQ2hbCnMqqsz0MiZRVyJt33lqPcKK4X74C+w== X-Received: by 10.159.35.67 with SMTP id 61mr3485608uae.17.1488469624266; Thu, 02 Mar 2017 07:47:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 02 Mar 2017 15:46:53 +0000 Message-ID: To: Andreas Heigl , PHP Internals Content-Type: multipart/alternative; boundary=001a113734be36a3750549c157a1 Subject: Re: [PHP-DEV] New constants in DateTime From: crocodile2u@gmail.com (Crocodile) --001a113734be36a3750549c157a1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable While I agree with everything you're saying, I also think it could still 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 time in a context where it does not matter if a minute has 60 seconds or not, or if a day has 24h or not. Particularly often used to specify cache lifetime, for example. 2. It's surely easy to implement them in userland but that would require 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. 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=B0= 23'58" | > | http://andreas.heigl.org http://hei.gl/wiFKy7 | > +---------------------------------------------------------------------+ > | http://hei.gl/root-ca | > +---------------------------------------------------------------------+ > > -- Best regards, Victor Bolshov --001a113734be36a3750549c157a1--