2

On one system I'm getting date command output like below

system1# date 
Thu Oct 18 10:34:36 BST 2018

while another similar box is showing it like

system2#date 
Thu 18 Oct 10:34:50 BST 2018

Both showing Month at different column. When I do an

env LC_ALL=C date

on the system2 , I get it in normal way as "Thu Oct 18 10:34:36 BST 2018"

on both system, the local shows same without any difference.

#locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=

any idea

  • 1
    What is env LC_ALL date meant to do? This command fails for me, with env: ‘LC_ALL’: No such file or directory. The system2 date is the correct format for your locale. What is the output of LC_TIME="en_GB.UTF-8" date on both systems? – Sparhawk Oct 18 '18 at 9:58
  • apologies, its env LC_ALL=C date which gives me the standard date on system2 – Nasir Mahmood Oct 18 '18 at 10:23
  • just run tzselect on your machine and off you go. – Valentin Bajrami Oct 18 '18 at 10:23
  • Nasir, your question got cut off. “Any idea ... why system1 is showing the date differently from system2 and how can I make system2’s date look like system1’s?” Maybe? – Jeff Schaller Oct 18 '18 at 10:31
  • What are the two OS versions? What are the locale definitions? Please post the output of locale date_fmt from either. – RudiC Oct 18 '18 at 10:41
1

So you get the output in the US format (when LC_ALL is set to the default) or you get it in the English variant.

Note that the strange order in the date format used by the US people is used in very few other countries as well...and definitely not in England

So if you like the same output on both system, set up the same locale on both systems or use the explicit date format:

date '+%a %b %e %T %Z %Y'

This example uses the date format that is the default for the C locale.

  • my concern is that even the local output on both systems is exactly same as I have already posted in my OP, the system2 is showing month in different column than standard. what is causing this behavior. – Nasir Mahmood Oct 18 '18 at 10:24
0

If you want to have a standard date output, use the ISO 8601 flag

robert@pip2:/tmp$ date
Thu May 30 07:16:51 PDT 2019
robert@pip2:/tmp$ date --iso-8601
2019-05-30
robert@pip2:/tmp$ 

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.