freedomsex / base-utilites
Installs: 1 083
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2.0
README
DateOffset
inc
- increase, dec
- decrease. Time periods:
- Sec
- Min
- Hour
- Day
- Month
DateOffset::incSec($sec = 1, $time = null);
DateOffset::decDay($day = 1, $time = null);
The first parameter is the period(default 1). The second parameter is optional - time, timestamp. If not specified, countdown from now.
DateOffset::incDay(5); // from now, time() + 5 days
DateOffset::decHour(); // 1 hour ago (default 1)
DateOffset::decDay(2, '2020-02-02 20:20:02');
// 2020-01-31 20:20:02
DateOffset::offset($sec, $time = null, $negative = false);