MATLAB Answers

Why do I get errors or warnings about my system time zone on macOS High Sierra (version 10.13) or later?

23 views (last 30 days)
If you run MATLAB on macOS High Sierra (version 10.13) or later, and you create a datetime array and specify its time zone as 'local', then it might throw errors or warnings that refer to the system time zone setting. These errors or warnings can occur even when the system time zone is set correctly. You might see an error message similar to:
Error using datetime (line 522)
The system time zone setting, 'local', is not valid. See the datetime.TimeZone property for details about specifying time zones.
Or a warning message similar to:
Warning: The system time zone setting, 'US/Eastern', does not specify a single time zone unambiguously.
It will be treated as 'America/New_York'. See the datetime.TimeZone property for details about specifying time zones.
when your system's time zone is not set to 'US/Eastern'. Also, if you use the PARPOOL command, it might throw an error or warning such as those shown above. The Parallel Computing Toolbox uses the datetime class during initialization.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Aug 2018
This is a known issue with macOS High Sierra (version 10.13) or later. An External Bug Report has been published:
To work around the bug, set the 'TZ' environment variable to your desired time zone before starting MATLAB. For example, to set 'TZ' to the 'Europe/Brussels' time zone, add the following command to your MATLAB startup file:
setenv('TZ','Europe/Brussels')
To find the correct time zone name for your location, use the TIMEZONES function in MATLAB.
  3 Comments
Nicholas Davey
Nicholas Davey on 17 Jun 2020
I also see this problem using R2018b on Ubuntu 18.04 LTS. So the problem is not limited to MacOS.
My system correctly has the timezone as 'Europe/London' but Matlab somehow obtains GB-Eire as the timezone and warns about the ambiguity of such.
Note that the link to the bugreport above points to some other bug report. That is weird.

Sign in to comment.

More Answers (1)

Peter Drummond
Peter Drummond on 26 May 2020
Seems an unnecessary complexity IMHO. Why not give users an option to turn the warning off completely, since I can't think of any reason for doing this in my current work. If it ain't broke, .....

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by