DateTimeHelper
in package
DateTimeHelper
Tags
Table of Contents
Methods
- convertDateIntervalToSeconds() : int
- Converts a DateInterval object into seconds
- getDateInterval() : DateInterval
- Converts two given DateTime instances or strings into a DateInterval
- getTimeFormat() : mixed
- roundToNextFullHour() : DateTime
- Rounds given DateTime object to the next full hour
Methods
convertDateIntervalToSeconds()
Converts a DateInterval object into seconds
public
static convertDateIntervalToSeconds(DateInterval $interval) : int
Parameters
- $interval : DateInterval
Return values
int —the seconds
getDateInterval()
Converts two given DateTime instances or strings into a DateInterval
public
static getDateInterval([DateTime|string|null $startDateTime = null ], DateTime $endDateTime) : DateInterval
Parameters
- $startDateTime : DateTime|string|null = null
-
the start date or null for current date time
- $endDateTime : DateTime
-
the end date time
Return values
DateIntervalgetTimeFormat()
public
static getTimeFormat() : mixed
roundToNextFullHour()
Rounds given DateTime object to the next full hour
public
static roundToNextFullHour([DateTime $dateTime = null ]) : DateTime
Parameters
- $dateTime : DateTime = null