Main Content

timezone

Time zone based on longitude

    Description

    [zd,zltr,zone] = timezone(lon) returns the integer zone description zd, the alphabetical zone indicator zltr, and the complete zone description and alphabetical zone indicator zone that correspond to the input longitude lon.

    example

    [zd,zltr,zone] = timezone(lon,units) specifies the angle units units for the longitude.

    Examples

    collapse all

    Display the zone description and alphabetical zone indicator for each time zone, excluding +12 Y.

    lon = 0:15:360;
    [zd,zltr,zone] = timezone(lon);
    zone
    zone = 25×5 char array
        '  0 Z'
        ' -1 A'
        ' -2 B'
        ' -3 C'
        ' -4 D'
        ' -5 E'
        ' -6 F'
        ' -7 G'
        ' -8 H'
        ' -9 I'
        '-10 K'
        '-11 L'
        '-12 M'
        '+11 X'
        '+10 W'
        ' +9 V'
        ' +8 U'
        ' +7 T'
        ' +6 S'
        ' +5 R'
        ' +4 Q'
        ' +3 P'
        ' +2 O'
        ' +1 N'
        '  0 Z'
    
    

    Input Arguments

    collapse all

    Longitude, specified as a numeric scalar or a numeric array.

    Angle unit for the longitude, specified as one of these options:

    • "degrees" — Degrees

    • "radians" — Radians

    Data Types: char | string

    Output Arguments

    collapse all

    Zone description, returned as an integer or a vector of integers. The data type of zd matches the data type of lon.

    Alphabetical zone indicator, returned as a character vector or a character array.

    Data Types: char

    Complete zone description and alphabetical zone indicator, returned as a character vector or a character array.

    Data Types: char

    Limitations

    National and local governments set their own time zone boundaries for political or geographic convenience. The timezone function does not account for deviations from the meridian-based system.

    More About

    collapse all

    Version History

    Introduced before R2006a

    See Also

    Functions