User avatar
DAI-X
Posts: 34
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

bash command DATE output format changed?

Sat Jul 13, 2019 2:15 am

Morning all

I have noticed that the default output of the bash command DATE seems to have changed between Stretch and Buster, i.e

Stretch
Sat 13 Jul 03:09:33 BST 2019

Buster
Sat 13 Jul 2019 03:09:28 AM BST

after midday the Buster date format is in a 12 hour clock format with PM attached. Is this normal, is there something in a config file I need to change, or do I have to change every instance of this in my scripts to reformat back to 24 hour format?

thanks

Andyroo
Posts: 4237
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: bash command DATE output format changed?

Sat Jul 13, 2019 2:28 am

Have you set the locale etc in raspi-config?

There have been a few issues with keyboards etc. in Buster.

Mine is smack up to date with updates (as of this evening) and reports the date as per Stretch (Pi 3B+)
Need Pi spray - these things are breeding in my house...

User avatar
DAI-X
Posts: 34
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

Re: bash command DATE output format changed?

Sat Jul 13, 2019 2:38 am

yeah, I had been fiddling with the locale setting to try to fix the keyboard! well spotted. Have changed it and DATE is back to original format

HOWEVER when I go into raspi-config and change to EN_GB_UTF-8 I get this.... I accidentally had it on en_US_UTF-8 before. Any idea how to fix?

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
en_GB.UTF-8... done
Generation complete.
*** update-locale: Error: invalid locale settings: LANG=en_GB.UTF-8 LC_ALL=en_US.UTF-8 LANGUAGE=en_US.UTF-8

klricks
Posts: 6552
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: bash command DATE output format changed?

Sat Jul 13, 2019 2:50 am

DAI-X wrote:
Sat Jul 13, 2019 2:38 am
yeah, I had been fiddling with the locale setting to try to fix the keyboard! well spotted. Have changed it and DATE is back to original format

HOWEVER when I go into raspi-config and change to EN_GB_UTF-8 I get this.... I accidentally had it on en_US_UTF-8 before. Any idea how to fix?

....
I don't know if this will fix but in locale setting menu be sure to deselect the ones that you don't want.
When using date In scripts you should use formatting options to assure you get what you want.
See:

Code: Select all

date --help
man date 
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
DAI-X
Posts: 34
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

Re: bash command DATE output format changed?

Sat Jul 13, 2019 3:06 am

aha

I seem to have fixed it by

sudo nano /etc/default/locale

and changing instances of US to GB..

thanks!

Return to “General discussion”