PHP: Dominate dates with intervals and periods
<p>There is also an assumption that handling time can be a pain in the you-know-where, so it’s normal that most applications try to use manage time only if needed, and usually in a very simple manner. UNIX timestamps are the norm, and time formatting is mostly exclusive to presentational aspects.</p>
<p>Your application may never use anything more than start and ending dates, and may be checking the next month from a given moment. While that’s fine, in the <a href="https://darkghosthunter.medium.com/apps-are-now-subscriptions-1861b00fc921" rel="noopener">age of subscriptions</a> some projects may be forced to handle time in complex manners. For example, one app may be willing to handle billing internally rather than giving away payment fees to gateways like Stripe, Braintree and many others.</p>
<p>Luckily for us, PHP has two tools very useful for calculate time back and forth: intervals and periods.</p>
<h1>What’s an interval?</h1>
<p>In PHP, the <code>DateInterval</code> object exists to describe the duration of time. For example, 6 days, or 45 minutes. There is no start date, no end date, just duration.</p>
<p><a href="https://darkghosthunter.medium.com/php-dominate-dates-with-intervals-and-periods-7e66351e6ce2"><strong>Click Here</strong></a></p>