Menu

## CarbonTimeZone extends DateTimeZone
in package
Uses LocalFactory

CarbonTimeZone.php : 24

### 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

CarbonTimeZone.php : 28
`public mixed MAXIMUM_TIMEZONE_OFFSET = 99`

### Properties

#### $clock

LocalFactory.php : 29

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

`private WrapperClock|null $clock = null`

### Methods

#### __construct()

CarbonTimeZone.php : 30
`public __construct(string|int|float $timezone) : mixed`

##### Parameters

$timezone : string|int|float

#### __toString()

CarbonTimeZone.php : 239

Cast to string (get timezone name).

`public __toString() : string`

##### Return values

string

#### cast()

CarbonTimeZone.php : 69

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()

CarbonTimeZone.php : 263

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()

CarbonTimeZone.php : 275

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()

CarbonTimeZone.php : 287

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()

CarbonTimeZone.php : 152
`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()

CarbonTimeZone.php : 128

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

`public getAbbreviatedName([bool $dst = false ]) : string`

##### Parameters

$dst : bool = false

##### Return values

string

#### getClock()

LocalFactory.php : 31
`public getClock() : WrapperClock|null`

##### Return values

WrapperClock|null

#### getOffsetNameFromMinuteOffset()

CarbonTimeZone.php : 299

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()

CarbonTimeZone.php : 251

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()

CarbonTimeZone.php : 92

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()

CarbonTimeZone.php : 160

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()

CarbonTimeZone.php : 170

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()

CarbonTimeZone.php : 181

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()

CarbonTimeZone.php : 219

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()

CarbonTimeZone.php : 49
`protected static getDateTimeZoneNameFromMixed(string|int|float $timezone) : string`

##### Parameters

$timezone : string|int|float

##### Return values

string

#### parseNumericTimezone()

CarbonTimeZone.php : 37
`protected static parseNumericTimezone(string|int|float $timezone) : string`

##### Parameters

$timezone : string|int|float

##### Return values

string

#### getFactory()

LocalFactory.php : 63
`private getFactory() : Factory`

##### Return values

Factory

#### initLocalFactory()

LocalFactory.php : 36
`private initLocalFactory() : void`

#### resolveCarbon()

CarbonTimeZone.php : 310
`private resolveCarbon(DateTimeInterface|null $date) : DateTimeInterface`

##### Parameters

$date : DateTimeInterface|null

##### Return values

DateTimeInterface

#### transmitFactory()

LocalFactory.php : 51

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

## Search results