class CarbonTimeZone extendsDateTimeZone

Methods

__construct($timezone =null)

No description

static 
parseNumericTimezone($timezone)

No description

static 
getDateTimeZoneNameFromMixed($timezone)

No description

static 
getDateTimeZoneFromName($name)

No description

cast(string$className)

Cast the current instance into the given class.

static false|CarbonTimeZone
instance(DateTimeZone|string|int|null$object =null,DateTimeZone|string|int|null$objectDump =null)

Create a CarbonTimeZone from mixed input.

string
getAbbreviatedName(bool$dst =false)

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

string
getAbbr(bool$dst =false)

No description

string
toOffsetName(DateTimeInterface$date =null)

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

toOffsetTimeZone(DateTimeInterface$date =null)

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

string|false
toRegionName(DateTimeInterface$date =null,int$isDst =1)

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

toRegionTimeZone(DateTimeInterface$date =null)

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

string
__toString()

Cast to string (get timezone name).

getType()

Return the type number:

static false|CarbonTimeZone
create(DateTimeZone|string|int|null$object =null)

Create a CarbonTimeZone from mixed input.

static false|CarbonTimeZone
createFromHourOffset(float$hourOffset)

Create a CarbonTimeZone from int/float hour offset.

static false|CarbonTimeZone
createFromMinuteOffset(float$minuteOffset)

Create a CarbonTimeZone from int/float minute offset.

static string
getOffsetNameFromMinuteOffset(float$minutes)

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

Details

at line22
__construct($timezone =null)

Parameters

$timezone

at line27
staticprotected parseNumericTimezone($timezone)

Parameters

$timezone

at line36
staticprotected getDateTimeZoneNameFromMixed($timezone)

Parameters

$timezone

at line53
staticprotected getDateTimeZoneFromName($name)

Parameters

$name

at line65
DateTimeZone cast(string$className)

Cast the current instance into the given class.

Parameters

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

Return Value

DateTimeZone

at line88
staticfalse|CarbonTimeZone instance(DateTimeZone|string|int|null$object =null,DateTimeZone|string|int|null$objectDump =null)

Create a CarbonTimeZone from mixed input.

Parameters

DateTimeZone|string|int|null $object original value to get CarbonTimeZone from it.
DateTimeZone|string|int|null $objectDump dump of the object for error messages.

Return Value

false|CarbonTimeZone

Exceptions

InvalidTimeZoneException

at line122
string getAbbreviatedName(bool$dst =false)

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

Parameters

bool $dst

Return Value

string

at line146
string getAbbr(bool$dst =false)

Parameters

bool $dst

Return Value

string

at line158
string toOffsetName(DateTimeInterface$date =null)

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

Parameters

DateTimeInterface $date

Return Value

string

at line172
CarbonTimeZone toOffsetTimeZone(DateTimeInterface$date =null)

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

Parameters

DateTimeInterface $date

Return Value

CarbonTimeZone

at line188
string|false toRegionName(DateTimeInterface$date =null,int$isDst =1)

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

Parameters

DateTimeInterface $date
int $isDst

Return Value

string|false

See also

timezone_name_from_abbr native PHP function.

at line230
CarbonTimeZone|false toRegionTimeZone(DateTimeInterface$date =null)

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

Parameters

DateTimeInterface $date

Return Value

CarbonTimeZone|false

at line250
string __toString()

Cast to string (get timezone name).

Return Value

string

at line262
getType()

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

at line274
staticfalse|CarbonTimeZone create(DateTimeZone|string|int|null$object =null)

Create a CarbonTimeZone from mixed input.

Parameters

DateTimeZone|string|int|null $object

Return Value

false|CarbonTimeZone

at line286
staticfalse|CarbonTimeZone createFromHourOffset(float$hourOffset)

Create a CarbonTimeZone from int/float hour offset.

Parameters

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

Return Value

false|CarbonTimeZone

at line298
staticfalse|CarbonTimeZone createFromMinuteOffset(float$minuteOffset)

Create a CarbonTimeZone from int/float minute offset.

Parameters

float $minuteOffset number of total minutes of the timezone shift.

Return Value

false|CarbonTimeZone

at line310
staticstring getOffsetNameFromMinuteOffset(float$minutes)

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

Parameters

float $minutes number of total minutes of the timezone shift.

Return Value

string