Methods |
public
|
__construct($timezone = null)
|
#
|
public
|
cast(string $className): DateTimeZone
Cast the current instance into the given class.
Cast the current instance into the given class.
Parameters
$className |
The $className::instance() method will be called to cast the current object.
|
|
#
|
public
static
|
instance(DateTimeZone|string|int|null $object = null, DateTimeZone|string|int|null $objectDump = null): false|static
Create a CarbonTimeZone from mixed input.
Create a CarbonTimeZone from mixed input.
Parameters
$object |
original value to get CarbonTimeZone from it.
|
$objectDump |
dump of the object for error messages.
|
Throws
|
#
|
public
|
getAbbreviatedName(bool $dst = false): string
Returns abbreviated name of the current timezone according to DST setting.
Returns abbreviated name of the current timezone according to DST setting.
|
#
|
public
|
getAbbr(bool $dst = false): string
|
#
|
public
|
toOffsetName(DateTimeInterface|null $date = null): string
Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").
Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").
|
#
|
public
|
toOffsetTimeZone(DateTimeInterface|null $date = null): CarbonTimeZone
Returns a new CarbonTimeZone object using the offset string instead of region string.
Returns a new CarbonTimeZone object using the offset string instead of region string.
|
#
|
public
|
toRegionName(DateTimeInterface|null $date = null, int $isDst = 1): string|false
Returns the first region string (such as "America/Toronto") that matches the current timezone or
false if no match is…
Returns the first region string (such as "America/Toronto") that matches the current timezone or
false if no match is found.
|
#
|
public
|
toRegionTimeZone(DateTimeInterface|null $date = null): CarbonTimeZone|false
Returns a new CarbonTimeZone object using the region string instead of offset string.
Returns a new CarbonTimeZone object using the region string instead of offset string.
|
#
|
public
|
__toString(): string
Cast to string (get timezone name).
Cast to string (get timezone name).
|
#
|
public
|
getType(): int
Return the type number:
Return the type number:
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
|
#
|
public
static
|
create(DateTimeZone|string|int|null $object = null): false|static
Create a CarbonTimeZone from mixed input.
Create a CarbonTimeZone from mixed input.
|
#
|
public
static
|
createFromHourOffset(float $hourOffset): false|static
Create a CarbonTimeZone from int/float hour offset.
Create a CarbonTimeZone from int/float hour offset.
Parameters
$hourOffset |
number of hour of the timezone shift (can be decimal).
|
|
#
|
public
static
|
createFromMinuteOffset(float $minuteOffset): false|static
Create a CarbonTimeZone from int/float minute offset.
Create a CarbonTimeZone from int/float minute offset.
Parameters
$minuteOffset |
number of total minutes of the timezone shift.
|
|
#
|
public
static
|
getOffsetNameFromMinuteOffset(float $minutes): string
Convert a total minutes offset into a standardized timezone offset string.
Convert a total minutes offset into a standardized timezone offset string.
Parameters
$minutes |
number of total minutes of the timezone shift.
|
|
#
|