Am 02.03.17 um 16:46 schrieb Crocodile: > 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. 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 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. 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… But as I said: just my 0.02€ 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 <andr...@heigl.org> 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 = "Y-m-d H:i:s"; >>> const SQL_DATE = "Y-m-d"; >>> const SQL_TIME = "H:i:s"; >>> const SECOND = 1; >>> const MINUTE = 60; >> Not every minute has 60 seconds. >>> const HOUR = 3600; >> See above! >>> const DAY = 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… >> >> But that's just my 0.02€ >> >> Cheers >> >> Andreas >> >> >> -- >> ,,, >> (o o) >> +---------------------------------------------------------ooO-(_)-Ooo-+ >> | Andreas Heigl | >> | mailto:andr...@heigl.org N 50°22'59.5" E 08°23'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:andr...@heigl.org N 50°22'59.5" E 08°23'58" | | http://andreas.heigl.org http://hei.gl/wiFKy7 | +---------------------------------------------------------------------+ | http://hei.gl/root-ca | +---------------------------------------------------------------------+
smime.p7s
Description: S/MIME Cryptographic Signature