Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-14-2012, 01:27 AM   #1
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,071

Rep: Reputation: 59
date: want to change UTC to local in the displayed system time.


The problem:
semoi@darkstar:~$ date
Wed Nov 14 03:10:15 UTC 2012
But I want the following to happen:
semoi@darkstar:~$ date
Wed Nov 14 00:10:15 ART 2012
In a word, I want date to display local time, not UTC time.

The attempted solution:
The man page begins:
       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
To set the time, I'll stick to the second syntax. And I see that, if by using -u the time will be interpreted by date as UTC, then by not using -u, date will interpret the time specified in the command line is local time. This, however, does not work so. Use of the option in the second syntax is irrelevant. It's always interpreted as UTC time.

But I can always mentally transform local time to UTC and use the second syntax to set the desired time. Only that still I have to make the date command to display the time as local time. These man pages are so concise! They seem written for a person already _very_ familiar with Linux. I do not say that they do not use a rigorous and technical language. But they should be written with any kind of reader in mind, not just the one who is an old linux user. Perhaps I'm dumb, but I say I have never got it with this damned date man page!@

EDIT: the date I can always set it, which is the most important part. If date gets it as if I am giving him UTC time, OK, I specify time, in the command line, as UTC time. From the point of view of filesystem maintainance this is all that matters. So, this post is not that important to me, I have just realized.

Last edited by stf92; 11-14-2012 at 01:41 AM.
Old 11-14-2012, 05:55 AM   #2
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
Old 11-14-2012, 07:56 AM   #3
LQ Newbie
Registered: Nov 2012
Distribution: Gentoo/Slackware
Posts: 1

Rep: Reputation: Disabled
It seems like you haven't set the correct timezone in the system please try
root@aya:~$ cp /usr/share/zoneinfo/Europe/London /etc/localtime
Of course, change the "Europe/London" to your timezone.
Some distributions have other ways of setting this, just googling for "distroname how to set timezone" should do.

Afterwards, it might be a good idea to run ntpdate to sync the time:
root@aya:~$ ntpdate
1 members found this post helpful.
Old 11-16-2012, 01:23 AM   #4
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,071

Original Poster
Rep: Reputation: 59
As I said before, considering the system insisted displaying time (date command) as UTC time, I converted the local time to UTC and reset time to this time. The system would continue displaying UTC time now, but this would agree with local time. I mean, Buenos Aires is GMT - 3. When the time by my watch is 5am, date now displays 8 UTC which is correct. Of course, the point was I want to have the time displayed as local time.

But now, I am seeing something strange has happened: the time is being displayed, say

02:47:58 ART 2012

It was 'UTC' that was in the string printed before, not 'ART', that was what I wanted. And the time is correct.

Honestly, I many times have a issue which is not some urgent problem I must fix, but a rather less utilitarian question. And people from LQ do not seem interested in answering theoretical questions. If I come with a very concrete problem, that's fine. But generalities seem to be always out of the order of the day. And I do not understand this attitude.

Just commenting. Because if I'd now say that the real problem is that I cannot understand the date man page, somebody would ask: what do you want to do. I repeat it. That man page seems confusing and incomplete to me. Perhaps just a couple of clarifications would make me to understand the whole man page. And googling won't make the situation look better. They generally present you with a version of the same man page.

Do not worry. I will, some of these days, devout my best effort to understand the date command usage and, by the way, will find the reason why it is so obscure to me now, or the kind of people that wrote that page.

ntpdate I can't run it because when the installer ask for the services to run at startup, I said no to ntpdate. Plus, if ntpdate is running and I, for some reason, want to set the date manually, that can be, they told me in LQ, harmful to the system.

Last edited by stf92; 11-16-2012 at 01:27 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Log Date/time doesn't change with system time saurabhchokshi Linux - Software 5 07-07-2010 01:27 AM
Timzone Issues...Local Time versus UTC time? as400 Solaris / OpenSolaris 12 09-26-2008 01:40 PM
Change UTC to LOCAL TIME in etch?? slackass Debian 4 08-03-2007 06:39 PM
Code for changing system's local date & time g4j31a5 Programming 8 03-21-2007 06:02 AM
Cannot set time/date to other time zone than UTC (Kubuntu) jamangold Ubuntu 1 12-23-2005 06:42 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:05 AM.

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