[SOLVED] date: want to change UTC to local in the displayed system time.
Linux - NewbieThis 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!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
date: want to change UTC to local in the displayed system time.
Hi:
The problem:
Code:
semoi@darkstar:~$ date
Wed Nov 14 03:10:15 UTC 2012
semoi@darkstar:~$
But I want the following to happen:
Code:
semoi@darkstar:~$ date
Wed Nov 14 00:10:15 ART 2012
semoi@darkstar:~$
In a word, I want date to display local time, not UTC time.
The attempted solution:
The man page begins:
Code:
SYNOPSIS
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.
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:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.