Main Content

timezone

Time zone based on longitude

    Description

    example

    [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.

    [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 = 25x5 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

    Time Zones

    The position of the sun relative to the prime meridian (the zero longitude line through Greenwich, England) determines the time. When the prime meridian lies directly below the sun, the time is noon Coordinate Universal Time (UTC).

    For local times elsewhere, the Earth is divided into 15° longitude bands (or zones), each centered on a central meridian. When a central meridian lies directly below the sun, Local Mean Time (LMT) in that zone is noon.

    The zone description is the result of subtracting LMT from UTC. For notational convenience, each zone also has an alphabetical zone indicator.

    World map with zone descriptions and alphabetical zone indicators

    The zone centered on the International Date Line (180° E/W) is split into two zones: +12 Y and -12 M.

    Version History

    Introduced before R2006a

    See Also

    Functions