CarbonTimeZone
extends DateTimeZone
in package
Table of Contents
- __construct() : mixed
- __toString() : string
- Cast to string (get timezone name).
- cast() : DateTimeZone
- 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.
- getOffsetNameFromMinuteOffset() : string
- Convert a total minutes offset into a standardized timezone offset string.
- instance() : false|static
- Create a CarbonTimeZone from mixed input.
- toOffsetName() : string
- Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").
- toOffsetTimeZone() : CarbonTimeZone
- Returns a new CarbonTimeZone object using the offset string instead of region string.
- toRegionName() : string
- Returns the first region string (such as "America/Toronto") that matches the current timezone.
- toRegionTimeZone() : CarbonTimeZone|false
- Returns a new CarbonTimeZone object using the region string instead of offset string.
- getDateTimeZoneFromName() : mixed
- getDateTimeZoneNameFromMixed() : mixed
- parseNumericTimezone() : mixed
Methods
__construct()
public
__construct([mixed $timezone = null ]) : mixed
Parameters
- $timezone : mixed = null
Return values
mixed —__toString()
Cast to string (get timezone name).
public
__toString() : string
Return values
string —cast()
Cast the current instance into the given class.
public
cast(string $className) : DateTimeZone
Parameters
- $className : string
-
The $className::instance() method will be called to cast the current object.
Return values
DateTimeZone —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
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 —instance()
Create a CarbonTimeZone from mixed input.
public
static instance([DateTimeZone|string|int|null $object = null ][, DateTimeZone|string|int|null $objectDump = null ]) : false|static
Parameters
- $object : DateTimeZone|string|int|null = null
-
original value to get CarbonTimeZone from it.
- $objectDump : DateTimeZone|string|int|null = null
-
dump of the object for error messages.
Tags
Return values
false|static —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 ]) : CarbonTimeZone
Parameters
- $date : DateTimeInterface|null = null
Return values
CarbonTimeZone —toRegionName()
Returns the first region string (such as "America/Toronto") that matches the current timezone.
public
toRegionName([DateTimeInterface|null $date = null ][, int $isDst = 1 ]) : string
Parameters
- $date : DateTimeInterface|null = null
- $isDst : int = 1
Tags
Return values
string —toRegionTimeZone()
Returns a new CarbonTimeZone object using the region string instead of offset string.
public
toRegionTimeZone([DateTimeInterface|null $date = null ]) : CarbonTimeZone|false
Parameters
- $date : DateTimeInterface|null = null
Return values
CarbonTimeZone|false —getDateTimeZoneFromName()
protected
static getDateTimeZoneFromName(mixed &$name) : mixed
Parameters
- $name : mixed
Return values
mixed —getDateTimeZoneNameFromMixed()
protected
static getDateTimeZoneNameFromMixed(mixed $timezone) : mixed
Parameters
- $timezone : mixed
Return values
mixed —parseNumericTimezone()
protected
static parseNumericTimezone(mixed $timezone) : mixed
Parameters
- $timezone : mixed