HumHub Documentation (unofficial)

DateTimeHelper
in package

DateTimeHelper

Tags
author

Luke

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
DateInterval

roundToNextFullHour()

Rounds given DateTime object to the next full hour

public static roundToNextFullHour([DateTime $dateTime = null ]) : DateTime
Parameters
$dateTime : DateTime = null
Return values
DateTime

        
On this page

Search results