LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
LinkBack Search this Thread
Old 11-14-2012, 12:27 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 2,925

Rep: Reputation: 45
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.

Last edited by stf92; 11-14-2012 at 12:41 AM.
 
Old 11-14-2012, 04:55 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 717

Rep: Reputation: 102Reputation: 102
http://www.wikihow.com/Change-the-Timezone-in-Linux
 
Old 11-14-2012, 06:56 AM   #3
kanojo
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
Code:
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:
Code:
root@aya:~$ ntpdate 0.pool.ntp.org
 
1 members found this post helpful.
Old 11-16-2012, 12:23 AM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 2,925

Original Poster
Rep: Reputation: 45
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 12:27 AM.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 12:27 AM
Timzone Issues...Local Time versus UTC time? as400 Solaris / OpenSolaris 12 09-26-2008 12:40 PM
Change UTC to LOCAL TIME in etch?? slackass Debian 4 08-03-2007 05:39 PM
Code for changing system's local date & time g4j31a5 Programming 8 03-21-2007 05:02 AM
Cannot set time/date to other time zone than UTC (Kubuntu) jamangold Ubuntu 1 12-23-2005 05:42 PM


All times are GMT -5. The time now is 04:18 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration