# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# tzoffset

Time zone offset from UTC

## Syntax

``dt = tzoffset(t)``
``````[dt,dst] = tzoffset(t)``````

## Description

example

````dt = tzoffset(t)` returns an array of durations equal to the time zone offset from UTC of each datetime value in `t`. That is, `dt` is the amount of time that each datetime in `t` differs from UTC. For datetimes that occur during Daylight Saving Time (DST), `dt` includes the time shift for DST. The offset for unzoned datetime values is not defined.```

example

``````[dt,dst] = tzoffset(t)``` additionally returns the time shift for Daylight Saving Time for each datetime in `t`.```

## Examples

collapse all

Create a `datetime` array in the time zone for New York City.

```t1 = datetime('today','TimeZone','America/New_York'); t = dateshift(t1,'end','month',[1:3:9])```
```t = 1x3 datetime array 30-Apr-2018 31-Jul-2018 31-Oct-2018 ```

Find the time zone offset from UTC and the time shift for Daylight Saving Time for each datetime value.

`[dt,dst] = tzoffset(t)`
```dt = 1x3 duration array -04:00 -04:00 -04:00 ```
```dst = 1x3 duration array 01:00 01:00 01:00 ```

## Input Arguments

collapse all

Input date and time, specified as a `datetime` array.

## Output Arguments

collapse all

Time zone offset from UTC, returned as a scalar, vector, matrix, or multidimensional `duration` array. `dt` is the same size as `t`.

Time shift for Daylight Saving Time, returned as a scalar, vector, matrix, or multidimensional `duration` array. `dt` is the same size as `t`. A value of `01:00` indicates that the corresponding datetime in `t` occurs during Daylight Saving Time in a location that observes it. For locations that do not observe Daylight Saving Time, the elements of the `dst` array are all `00:00`.

## See Also

#### Introduced in R2014b

Was this topic helpful?

Download eBook