LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-16-2020, 09:37 AM   #1
brainsys
LQ Newbie
 
Registered: Jan 2020
Posts: 9

Rep: Reputation: Disabled
Default Date Format


I've just commissioned a new Debian 10 server. Two oddities which may be related (or not).

All my Debian 10 systems until now put date as follows:
# date
Thu 16 Jan 15:25:21 GMT 2020

The new system ouputs:
# date
Thu 16 Jan 2020 03:25:59 PM GMT

The other oddity is that cron jobs on new system execute an hour earlier than requested.


My first thought was 'locale' but both are identical:
# cat /etc/default/locale
# File generated by update-locale
LANG="en_US.UTF-8"

I checked the Time zone, again both identical:
timedatectl
Local time: Thu 2020-01-16 15:30:15 GMT
Universal time: Thu 2020-01-16 15:30:15 UTC
RTC time: Thu 2020-01-16 15:30:16
Time zone: Europe/London (GMT, +0000)
System clock synchronized: yes
NTP service: inactive
RTC in local TZ: no


Research here and elsewhere is how to display time in different formats but silent so far on how 'date' finds its default format which, as you can see differs.

Anyone?
 
Old 01-16-2020, 12:15 PM   #2
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
Have a look a this thread https://www.linuxquestions.org/quest...ux-4175605092/

Maybe the cron daemon does not use the same timezone as you use as a user?
I would check the difference between your timezone and UTC.
 
Old 01-16-2020, 12:19 PM   #3
Guyverix
Member
 
Registered: Nov 2008
Location: Washington State
Distribution: Mint
Posts: 36

Rep: Reputation: 2
Any chance of cheating?
have cron fire off echo $(date) > to a file, and see what time it thinks it is when it fires? Assuming that cron daemon has been restarted as well. What time is it showing in syslog/messages?

also is this a crontab, or a cron residing in /etc/cron.d/ ?
 
Old 01-16-2020, 12:44 PM   #4
brainsys
LQ Newbie
 
Registered: Jan 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
One down, one to go ...

The cron offset is sorted. It had clearly not picked up the shift in timezone so a cron restart fixed it. Which leaves the more intriguing issue of the different date default formats. As a reminder:

user@A:~# date
Thu 16 Jan 18:28:24 GMT 2020

user@B:~# date
Thu 16 Jan 2020 06:30:17 PM GMT

That is 24hr v AM/PM and the position of the year. These are both brand new Debian 10 VPS from the same provider. All my other Debian 8/9/10 servers show system A format. So how does date determine it's default format and what could have screwed system B?

A free operating system for the first right answer

Last edited by brainsys; 01-16-2020 at 12:46 PM.
 
Old 01-16-2020, 12:52 PM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
see man locale and man date. [Most] probably the variable LC_ALL was set differently. But you need to check your environment and find the differences.
 
2 members found this post helpful.
Old 01-16-2020, 01:05 PM   #6
brainsys
LQ Newbie
 
Registered: Jan 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Aha! It's our friends across the pond who dunnit!

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

a quick export LANG=en_GB.UTF-8 got it sorted. Thanks.
 
Old 01-16-2020, 01:08 PM   #7
brainsys
LQ Newbie
 
Registered: Jan 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Well not quite - when I logout it reverts to its American ways ... must try harder.
 
Old 01-16-2020, 01:13 PM   #8
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
Do you set locale in bashrc or profile or any of the files they source?
 
Old 01-16-2020, 01:22 PM   #9
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Yes. /etc/profile.d/lang.sh on my desktop, but search through all the files in /etc/profile.d
 
Old 01-16-2020, 01:24 PM   #10
brainsys
LQ Newbie
 
Registered: Jan 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
All sorted. A quick dpkg-reconfigure locales got it to stick.
I usually use that to make the server speak proper English - but yesterday used another method which would work if your American but not if you're British.

Well that's it. All cosmetic really but annoying when you have a new server humming nicely. Learning point is to put dpkg-reconfigure locales on my ToDo list instead of 'change language'.

Thanks again and good night.
 
Old 01-16-2020, 01:26 PM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
if you really want to say thanks just click on yes.
If your problem is solved please mark the thread solved.
May I get that OS ?
 
1 members found this post helpful.
Old 01-16-2020, 03:39 PM   #12
brainsys
LQ Newbie
 
Registered: Jan 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
May I get that OS ?
It's in the post and i'll still love you in the morning
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to subtract current date and future date in YYYY-MM-DD format archie7 Linux - Newbie 11 05-11-2018 03:29 AM
[SOLVED] Converting date feed into different date format keif Programming 5 07-08-2014 08:39 AM
LXer: How to change Thunderbird's date format in Date column LXer Syndicated Linux News 0 07-18-2012 02:11 AM
Changing the default date format for Open Office.org pwabrahams Linux - Software 6 09-26-2010 09:05 PM
How do I set default Currency , Date format anilbh Fedora 3 07-05-2006 09:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration