Skip to content

@technobuddha > library > Time > Time Zone

Function: timezone()

ts
function timezone(input: 
  | number
  | Date, options: TimezoneOptions): string;

Defined in: timezone.ts:29

Determine the correct timezone string for a specified date using a local timezone, or an offset in minutes

Parameters

ParameterTypeDescription
input| number | DateThe date, or a timezone offset in minutes
optionsTimezoneOptionssee TimezoneOptions

Returns

string

the timezone offset formatted like '±hh:mm' the string is prefixed by 'gmt' if the option is set. If the z option is set 'z' is returned for the gmt+00:00 timezone

Remarks

the gmt flag overrides the z flag if both are set

Default Value

ts
gmt false

Default Value

ts
z true