timezones
Lists the time zones that datetime knows.
Category: Language Fundamentals > Data Types
Syntax
tz = timezones
Returns a table with all time zones.
tz = timezones(area)
Restricts the list to an area such as 'Africa' or 'America'.
Description
Use the names in the Name column, such as 'America/Sao_Paulo', with the 'TimeZone' option of datetime or with the TimeZone property of a datetime. Names with a region use the IANA time zone database format.
Input arguments
area- Name of a geographic area.
Output arguments
tz- Table with variables
Name,Area,UTCOffsetandDSTOffset: the zone name, its area, its offset from UTC, and its daylight-saving offset.
Example
Searching the zone list
tz = timezones();
class(tz)
any(strcmp(tz.Name, 'America/Sao_Paulo'))
tz2 = timezones('Africa');
tz2.Name(1)
Output
ans = 'table'
ans = logical
1
ans = 1×1 cell
{'Africa/Abidjan'}