I would like to have the output of date +"%B, %d %Y" in my local timezone but considering another timezone for the names (month name in this case).

In my system the date +"%B" outputs (please note the missing 'y' on 'JanuarY') :


I tried:

TZ=America/Los_Angeles date +"%B, %d %Y"


Januar, 31 2016

From the man page:

%B     **locale's** full month name (e.g., January)

So, I tried to fetch another sequence than %B but, I cannot find one.

TZ='America/Los_Angeles' date give the expected output (I ran this command at ~20h in my local timezone)

So 31. Jan 11:01:30 PST 2016

Here are some information (if it's relevant):

$ date --version`
  date (GNU coreutils) 8.23

$ date +%Z

$ uname -a
  Linux host 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • What is your desired output? How would the timezone change the month's name? If the date in the target timezone falls in a different month, then the corresponding month name will be shown. Please edit your question and show us what you would like date to print. – terdon Jan 31 '16 at 19:37
  • I'd like to have this output: January, 31 2016 (timezone orthograph dependent, english in this case, with a 'y') – Zermingore Jan 31 '16 at 19:43
  • OK, please edit and add that information as well as what a simple date shows on your system. I'm still not sure if what you want is a different timezone or just the output in a different language. – terdon Jan 31 '16 at 19:44

Month names are not tied to a timezone, but to locale.

$ LC_ALL=cs_CZ.utf8 date +%B
$ LC_ALL=es_ES.utf8 date +%B
| improve this answer | |
  • so, you're simply telling me it's not possible to have this output with date Can I change an environement variable to obtain a timezone-dependent output ? – Zermingore Jan 31 '16 at 19:44
  • @J.P.Quenord-Zermingore: No, I'm telling you the output depends on a variable. There are timezones that use more than one language. – choroba Jan 31 '16 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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