Documentation

DateTime
in package

DateTime class.

Table of Contents

$databaseTimeZone  : string
Time zone cache.
formatToDay()  : string
Function to parse dateTime into days.
formatToDb()  : string
Function to get date and time value for db format.
formatToDisplay()  : string
Function returns the date in user specified format.
formatToShort()  : string
Crop date if today and only return the hour.
formatToViewDate()  : string
The function returns the date according to the user's settings.
getDiff()  : int|string
Function returning difference in format between date times.
getTimeZone()  : string
Get system time zone.
sanitizeDbFormat()  : string
Function changes the datetime format to the database format without changing the time zone.

Properties

$databaseTimeZone

Time zone cache.

protected static string $databaseTimeZone = false

Methods

formatToDay()

Function to parse dateTime into days.

public static formatToDay(string $dateTime[, bool $allday = false ]) : string
Parameters
$dateTime : string

Date time

$allday : bool = false
Return values
string

formatToDb()

Function to get date and time value for db format.

public static formatToDb(string $value[, bool $leadingZeros = false ]) : string
Parameters
$value : string

Date time

$leadingZeros : bool = false
Return values
string

formatToDisplay()

Function returns the date in user specified format.

public static formatToDisplay(string $value) : string
Parameters
$value : string

Date time

Return values
string

formatToShort()

Crop date if today and only return the hour.

public static formatToShort(string $dateTime) : string
Parameters
$dateTime : string

Date time

Return values
string

formatToViewDate()

The function returns the date according to the user's settings.

public static formatToViewDate(string $dateTime) : string
Parameters
$dateTime : string

Date time

Return values
string

getTimeZone()

Get system time zone.

public static getTimeZone() : string
Return values
string

sanitizeDbFormat()

Function changes the datetime format to the database format without changing the time zone.

public static sanitizeDbFormat(string $value, string $fromFormat) : string
Parameters
$value : string
$fromFormat : string
Return values
string

        

Search results