php - the most accurate way to calucate date periods using the date object -
I am working on an access site, paying members are 3 month access period will get the site Therefore, this issue is to calculate a precise date of 3 months. i.e, a few months are 28 days, the other is 31 days; Normal year is 365 but Moon year is 354 days. I was thinking of changing the date to Unix timestamps and then calculating 3 months seconds. But I'm not sure that this is the most effective and accurate way to do this. Below is my proposal, I would like some advice about this; Timestamp when the clocks start / Number of days in months $ numberSecondsInDay = 86400; // 3 months new \ date time ("$ secondsIn3Months") one day $ secondsIn3Months = ($ numberDaysInMonth * $ numberSecondsInDay) * 3 // Number seconds in seconds; // As I said, as I said, this is the best thing, but I suspect that this is not correct.
$ UNIXtimeStampNow = new \ date time ("now")) - & gt; Calculation of 3 months from the date:
$ numberDaysInMonth = 30.41 = 365/12 / (3) of the format ('U')
$ d = new \ date time ("now"); $ D- & gt; Add (New \ Date Interface ('P3M')); Echo $ d- & gt; Format ('Y-M-DH: I: S');
Comments
Post a Comment