Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

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

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
lbm
Posts: 494
Joined: 2009-05-16 09:24
Location: Denmark

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

#1 Post by lbm »

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.

reinob
Posts: 1198
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: Convert "date" to show 24 hour format

#2 Post by reinob »

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).

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 505
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: Convert "date" to show 24 hour format

#3 Post by Bloom »

Code: Select all

sudo localectl set-locale LANG=en_US.utf8
sudo localectl set-locale LC_TIME=en_DK.UTF-8

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Convert "date" to show 24 hour format

#4 Post by phenest »

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
lbm
Posts: 494
Joined: 2009-05-16 09:24
Location: Denmark

Re: Convert "date" to show 24 hour format

#5 Post by lbm »

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.

Post Reply