When loading a .log file I get the message

Warning (emacs): Failed to determine system timezone; consider customizing ‘datetime-timezone’ variable

Going to the customization menu, the options are not evident:

Hide Datetime Timezone: nil
    State : STANDARD.
   Default timezone for date-time formatting and parsing. Hide
   Leave unset to let the library auto-determine it from your OS
   when necessary.
Groups: Datetime

Lines that also appear in the source

(defcustom datetime-timezone nil
  "Default timezone for date-time formatting and parsing.
Leave unset to let the library auto-determine it from your OS
when necessary."
  :group 'datetime
  :type  'symbol)
  1. What is the appropriate way to set my timezone on macOS so that datetime-timezone would inherit it without a duplication in ~/.emacs.
  2. Failing that, what is the format for this customization? (For some reason, C-h i does not include a menu for datetime in my installation.)

1 Answer 1


According to the documentation it should be determined with the TZ environment variable :

The default time zone is determined by the TZ environment variable. [...] For example, you can tell Emacs to default to Universal Time with (setenv "TZ" "UTC0"). If TZ is not in the environment, Emacs uses system wall clock time, which is a platform-dependent default time zone.

Have you tried to set this variable ?

You should be able to set it from Emacs, using eval-expression (M-:) :

(setenv "TZ" "America/New_York")

or you can set it at launch before running emacs command from your shell :

$ TZ="America/New_York" emacs

Tested successfully on Linux, but can't tell for Mac OS.

  • Can you add the relevant part from documentation to your post, as well as an example that works as expected?
    – user12563
    May 9, 2019 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.