Pionia Core

CarbonTimeZone extends DateTimeZone
in package
Uses LocalFactory

Table of Contents

Constants

MAXIMUM_TIMEZONE_OFFSET  = 99

Properties

$clock  : WrapperClock|null
The clock that generated the current instance (or FactoryImmutable::getDefaultInstance() if none)

Methods

__construct()  : mixed
__toString()  : string
Cast to string (get timezone name).
cast()  : DateTimeZone|mixed
Cast the current instance into the given class.
create()  : false|static
Create a CarbonTimeZone from mixed input.
createFromHourOffset()  : false|static
Create a CarbonTimeZone from int/float hour offset.
createFromMinuteOffset()  : false|static
Create a CarbonTimeZone from int/float minute offset.
getAbbr()  : string
getAbbreviatedName()  : string
Returns abbreviated name of the current timezone according to DST setting.
getClock()  : WrapperClock|null
getOffsetNameFromMinuteOffset()  : string
Convert a total minutes offset into a standardized timezone offset string.
getType()  : int
Return the type number:
instance()  : static|null
Create a CarbonTimeZone from mixed input.
toOffsetName()  : string
Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").
toOffsetTimeZone()  : static
Returns a new CarbonTimeZone object using the offset string instead of region string.
toRegionName()  : string|null
Returns the first region string (such as "America/Toronto") that matches the current timezone or false if no match is found.
toRegionTimeZone()  : self|null
Returns a new CarbonTimeZone object using the region string instead of offset string.
getDateTimeZoneNameFromMixed()  : string
parseNumericTimezone()  : string
getFactory()  : Factory
initLocalFactory()  : void
resolveCarbon()  : DateTimeInterface
transmitFactory()  : T
Trigger the given action using the local factory of the object, so it will be transmitted to any object also using this trait and calling initLocalFactory() in its constructor.

Constants

MAXIMUM_TIMEZONE_OFFSET

public mixed MAXIMUM_TIMEZONE_OFFSET = 99

Properties

$clock

The clock that generated the current instance (or FactoryImmutable::getDefaultInstance() if none)

private WrapperClock|null $clock = null

Methods

__construct()

public __construct(string|int|float $timezone) : mixed
Parameters
$timezone : string|int|float

__toString()

Cast to string (get timezone name).

public __toString() : string
Return values
string

cast()

Cast the current instance into the given class.

public cast(DateTimeZone> $className) : DateTimeZone|mixed
Parameters
$className : DateTimeZone>

The $className::instance() method will be called to cast the current object.

Return values
DateTimeZone|mixed

create()

Create a CarbonTimeZone from mixed input.

public static create([DateTimeZone|string|int|null $object = null ]) : false|static
Parameters
$object : DateTimeZone|string|int|null = null
Return values
false|static

createFromHourOffset()

Create a CarbonTimeZone from int/float hour offset.

public static createFromHourOffset(float $hourOffset) : false|static
Parameters
$hourOffset : float

number of hour of the timezone shift (can be decimal).

Return values
false|static

createFromMinuteOffset()

Create a CarbonTimeZone from int/float minute offset.

public static createFromMinuteOffset(float $minuteOffset) : false|static
Parameters
$minuteOffset : float

number of total minutes of the timezone shift.

Return values
false|static

getAbbr()

public getAbbr([bool $dst = false ]) : string
Parameters
$dst : bool = false
Tags
alias

getAbbreviatedName

Returns abbreviated name of the current timezone according to DST setting.

Return values
string

getAbbreviatedName()

Returns abbreviated name of the current timezone according to DST setting.

public getAbbreviatedName([bool $dst = false ]) : string
Parameters
$dst : bool = false
Return values
string

getOffsetNameFromMinuteOffset()

Convert a total minutes offset into a standardized timezone offset string.

public static getOffsetNameFromMinuteOffset(float $minutes) : string
Parameters
$minutes : float

number of total minutes of the timezone shift.

Return values
string

getType()

Return the type number:

public getType() : int

Type 1; A UTC offset, such as -0300 Type 2; A timezone abbreviation, such as GMT Type 3: A timezone identifier, such as Europe/London

Return values
int

instance()

Create a CarbonTimeZone from mixed input.

public static instance(DateTimeZone|string|int|false|null $object[, DateTimeZone|string|int|false|null $objectDump = null ]) : static|null
Parameters
$object : DateTimeZone|string|int|false|null

original value to get CarbonTimeZone from it.

$objectDump : DateTimeZone|string|int|false|null = null

dump of the object for error messages.

Tags
throws
InvalidTimeZoneException
Return values
static|null

toOffsetName()

Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").

public toOffsetName([DateTimeInterface|null $date = null ]) : string
Parameters
$date : DateTimeInterface|null = null
Return values
string

toOffsetTimeZone()

Returns a new CarbonTimeZone object using the offset string instead of region string.

public toOffsetTimeZone([DateTimeInterface|null $date = null ]) : static
Parameters
$date : DateTimeInterface|null = null
Return values
static

toRegionName()

Returns the first region string (such as "America/Toronto") that matches the current timezone or false if no match is found.

public toRegionName([DateTimeInterface|null $date = null ][, int $isDST = 1 ]) : string|null
Parameters
$date : DateTimeInterface|null = null
$isDST : int = 1
Tags
see
timezone_name_from_abbr

native PHP function.

Return values
string|null

toRegionTimeZone()

Returns a new CarbonTimeZone object using the region string instead of offset string.

public toRegionTimeZone([DateTimeInterface|null $date = null ]) : self|null
Parameters
$date : DateTimeInterface|null = null
Return values
self|null

getDateTimeZoneNameFromMixed()

protected static getDateTimeZoneNameFromMixed(string|int|float $timezone) : string
Parameters
$timezone : string|int|float
Return values
string

parseNumericTimezone()

protected static parseNumericTimezone(string|int|float $timezone) : string
Parameters
$timezone : string|int|float
Return values
string

resolveCarbon()

private resolveCarbon(DateTimeInterface|null $date) : DateTimeInterface
Parameters
$date : DateTimeInterface|null
Return values
DateTimeInterface

transmitFactory()

Trigger the given action using the local factory of the object, so it will be transmitted to any object also using this trait and calling initLocalFactory() in its constructor.

private transmitFactory(Closure $action) : T
Parameters
$action : Closure
Tags
template

T

Return values
T

        
On this page

Search results