-   Linux - Newbie (
-   -   date: want to change UTC to local in the displayed system time. (

stf92 11-14-2012 12:27 AM

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.

jv2112 11-14-2012 04:55 AM

kanojo 11-14-2012 06:56 AM

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

stf92 11-16-2012 12:23 AM

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.

All times are GMT -5. The time now is 07:33 AM.