vBulletin v6.0.4

vB_Entity_Datetime extends vB_Entity
in package
implements Stringable Uses vB_Trait_NoSerialize

Table of Contents

Interfaces

Stringable

Constants

DATETIME_MYSQL  = 'Y-m-d H:i:s'
TIMEZONES  = ['-12' => 'timezone_gmt_minus_1200', '-11' => 'timezone_gmt_minus_1100', '-10' => 'timezone_gmt_minus_1000', '-9.5' => 'timezone_gmt_minus_0930', '-9' => 'timezone_gmt_minus_0900', '-8' => 'timezone_gmt_minus_0800', '-7' => 'timezone_gmt_minus_0700', '-6' => 'timezone_gmt_minus_0600', '-5' => 'timezone_gmt_minus_0500', '-4.5' => 'timezone_gmt_minus_0430', '-4' => 'timezone_gmt_minus_0400', '-3.5' => 'timezone_gmt_minus_0330', '-3' => 'timezone_gmt_minus_0300', '-2' => 'timezone_gmt_minus_0200', '-1' => 'timezone_gmt_minus_0100', '0' => 'timezone_gmt_plus_0000', '1' => 'timezone_gmt_plus_0100', '2' => 'timezone_gmt_plus_0200', '3' => 'timezone_gmt_plus_0300', '3.5' => 'timezone_gmt_plus_0330', '4' => 'timezone_gmt_plus_0400', '4.5' => 'timezone_gmt_plus_0430', '5' => 'timezone_gmt_plus_0500', '5.5' => 'timezone_gmt_plus_0530', '5.75' => 'timezone_gmt_plus_0545', '6' => 'timezone_gmt_plus_0600', '6.5' => 'timezone_gmt_plus_0630', '7' => 'timezone_gmt_plus_0700', '8' => 'timezone_gmt_plus_0800', '8.5' => 'timezone_gmt_plus_0830', '8.75' => 'timezone_gmt_plus_0845', '9' => 'timezone_gmt_plus_0900', '9.5' => 'timezone_gmt_plus_0930', '10' => 'timezone_gmt_plus_1000', '10.5' => 'timezone_gmt_plus_1030', '11' => 'timezone_gmt_plus_1100', '12' => 'timezone_gmt_plus_1200']

Methods

__construct()  : mixed
__get()  : mixed
__serialize()  : array<string|int, mixed>
__set()  : void
__sleep()  : array<string|int, mixed>
__toString()  : string
__unserialize()  : void
__wakeup()  : void
calculateNextLeapYear()  : int
calculatePrevLeapYear()  : int
createFromArray()  : static
getUnixTimestamp()  : int
Calculate unixtime
getUnixTimestampForYear()  : int
Calculate unixtime for "equivalent" month/day hh:mm:ss for a different year
isLeapDateIgnoreYear()  : bool
isLeapYear()  : bool
jsonDecode()  : vB_Entity
Accept a json string and converts it back to an object instance. The string is intended to be an output from a json_encode($originalEntity->jsonSerialize(), true) call.
jsonSerialize()  : mixed
toArray()  : array<string|int, mixed>

Constants

DATETIME_MYSQL

public mixed DATETIME_MYSQL = 'Y-m-d H:i:s'

TIMEZONES

public mixed TIMEZONES = ['-12' => 'timezone_gmt_minus_1200', '-11' => 'timezone_gmt_minus_1100', '-10' => 'timezone_gmt_minus_1000', '-9.5' => 'timezone_gmt_minus_0930', '-9' => 'timezone_gmt_minus_0900', '-8' => 'timezone_gmt_minus_0800', '-7' => 'timezone_gmt_minus_0700', '-6' => 'timezone_gmt_minus_0600', '-5' => 'timezone_gmt_minus_0500', '-4.5' => 'timezone_gmt_minus_0430', '-4' => 'timezone_gmt_minus_0400', '-3.5' => 'timezone_gmt_minus_0330', '-3' => 'timezone_gmt_minus_0300', '-2' => 'timezone_gmt_minus_0200', '-1' => 'timezone_gmt_minus_0100', '0' => 'timezone_gmt_plus_0000', '1' => 'timezone_gmt_plus_0100', '2' => 'timezone_gmt_plus_0200', '3' => 'timezone_gmt_plus_0300', '3.5' => 'timezone_gmt_plus_0330', '4' => 'timezone_gmt_plus_0400', '4.5' => 'timezone_gmt_plus_0430', '5' => 'timezone_gmt_plus_0500', '5.5' => 'timezone_gmt_plus_0530', '5.75' => 'timezone_gmt_plus_0545', '6' => 'timezone_gmt_plus_0600', '6.5' => 'timezone_gmt_plus_0630', '7' => 'timezone_gmt_plus_0700', '8' => 'timezone_gmt_plus_0800', '8.5' => 'timezone_gmt_plus_0830', '8.75' => 'timezone_gmt_plus_0845', '9' => 'timezone_gmt_plus_0900', '9.5' => 'timezone_gmt_plus_0930', '10' => 'timezone_gmt_plus_1000', '10.5' => 'timezone_gmt_plus_1030', '11' => 'timezone_gmt_plus_1100', '12' => 'timezone_gmt_plus_1200']

Methods

__construct()

public __construct(string $dateOrDatetime[, string $tzoffset = "0" ][, string $defaultHourMinuteSecond = '00:00:00' ]) : mixed
Parameters
$dateOrDatetime : string
$tzoffset : string = "0"
$defaultHourMinuteSecond : string = '00:00:00'

__get()

public final __get(string $name) : mixed
Parameters
$name : string

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__set()

public final __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

public __toString() : string
Return values
string

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

calculateNextLeapYear()

public static calculateNextLeapYear(int $year) : int
Parameters
$year : int
Return values
int

calculatePrevLeapYear()

public static calculatePrevLeapYear(int $year) : int
Parameters
$year : int
Return values
int

createFromArray()

public static createFromArray(array<string|int, mixed> $dbrecord) : static
Parameters
$dbrecord : array<string|int, mixed>
Return values
static

getUnixTimestamp()

Calculate unixtime

public getUnixTimestamp(bool $leapForwards) : int
Parameters
$leapForwards : bool

If month/day is 02/29, whether to use 03/01 or 02/28 if $year is not a leap year. Generally speaking, you will want $leapForwards = true for start date & false for end date.

Return values
int

unixtimestamp

getUnixTimestampForYear()

Calculate unixtime for "equivalent" month/day hh:mm:ss for a different year

public getUnixTimestampForYear(int $year, bool $leapForwards) : int
Parameters
$year : int
$leapForwards : bool

If month/day is 02/29, whether to use 03/01 or 02/28 if $year is not a leap year. Generally speaking, you will want $leapForwards = true for start date & false for end date.

Return values
int

unixtimestamp

isLeapDateIgnoreYear()

public isLeapDateIgnoreYear() : bool
Return values
bool

isLeapYear()

public static isLeapYear(int $year) : bool
Parameters
$year : int
Return values
bool

jsonDecode()

Accept a json string and converts it back to an object instance. The string is intended to be an output from a json_encode($originalEntity->jsonSerialize(), true) call.

public final static jsonDecode(string $json) : vB_Entity
Parameters
$json : string
Return values
vB_Entity

jsonSerialize()

public final jsonSerialize() : mixed

toArray()

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results