[SOLVED] Convert "date" to show 24 hour format

If none of the more specific forums is the right place to ask

[SOLVED] Convert "date" to show 24 hour format

Postby lbm » 2019-09-06 15:03

It seems after updating to buster, that the command now shows the date in AM/PM (12 hour) timeset.
Can this be changed, so it shows 24 hours instead ?

I know, I can "mangle" it with the format options, but its not exactly what I want.

Code: Select all
#date
Fri 06 Sep 2019 05:51:42 PM CEST
Last edited by lbm on 2019-09-06 18:29, edited 1 time in total.
User avatar
lbm
 
Posts: 494
Joined: 2009-05-16 09:24
Location: Denmark

Re: Convert "date" to show 24 hour format

Postby reinob » 2019-09-06 15:47

What are your locale settings?

Run "locale" on the command prompt and post the output.
I have LC_TIME=en_DK.UTF-8 (gives you English with sane, er, European formatting).
reinob
 
Posts: 707
Joined: 2014-06-30 11:42

Re: Convert "date" to show 24 hour format

Postby Bloom » 2019-09-06 15:59

Code: Select all
sudo localectl set-locale LANG=en_US.utf8
sudo localectl set-locale LC_TIME=en_DK.UTF-8
User avatar
Bloom
 
Posts: 178
Joined: 2017-11-11 12:23

Re: Convert "date" to show 24 hour format

Postby phenest » 2019-09-06 18:25

Code: Select all
20:08 ~ $ date
Fri  6 Sep 20:08:27 BST 2019

I see nothing in the man pages as what its default output format is. Would the locale affect it 12/24 hour?
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D
User avatar
phenest
 
Posts: 1703
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Convert "date" to show 24 hour format

Postby lbm » 2019-09-06 18:29

Bloom wrote:
Code: Select all
sudo localectl set-locale LANG=en_US.utf8
sudo localectl set-locale LC_TIME=en_DK.UTF-8


Thanks, seems to have fixed it. It generates/sets LC_TIME in /etc/default/locale , and it now shows correctly after an relogin.
User avatar
lbm
 
Posts: 494
Joined: 2009-05-16 09:24
Location: Denmark


Return to General Questions

Who is online

Users browsing this forum: No registered users and 14 guests

fashionable