LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-14-2007, 06:26 AM   #1
estratos
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 85

Rep: Reputation: 15
"date" command and timezones


I have a simple question that is quite general for all Linux systems.

If I try to set a date within the daylight saving period, "date" treats my input as an UTC date so it automatically adds one hour to my date:

(I want to enter this date: Mar 30 12:13 2007)
# date -s 033012132007
Fri Mar 30 13:13:00 CETDST 2007

("date" adds one hour to my date)

# date
Fri Mar 30 13:13:05 CETDST 2007

How can I tell the system that my date is localtime and not UTC? the "date" man page says that the time zone can be entered in [+FORMAT]. Any example of this? Is there any way of doing this without entering the local timezone?

Thanks,

Daniel.
 
Old 03-14-2007, 11:42 PM   #2
mitchell7man
Member
 
Registered: Jan 2007
Location: Draper, UT
Distribution: Ubuntu, Windows 10, OSX
Posts: 461

Rep: Reputation: 31
Can't you just use the time configurations on the top right of your screen in ubuntu? P.S. what Linux are u using exactly, that might help, even if i don't have an answer, haha i'm new to it all. MJ
 
Old 03-15-2007, 06:27 AM   #3
estratos
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 85

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by mitchell7man
Can't you just use the time configurations on the top right of your screen in ubuntu? P.S. what Linux are u using exactly, that might help, even if i don't have an answer, haha i'm new to it all. MJ
Michael,

The time config is done on a remote server from an Internet browser.

Daniel.
 
Old 03-15-2007, 08:47 AM   #4
cconstantine
Member
 
Registered: Dec 2005
Distribution: RedHat, Ubuntu
Posts: 101

Rep: Reputation: 15
specify time in UTC

date --utc MMDDhhmmCCYY.ss

take your local wallclock time, shift it to UTC. Then set the date on the remote system tell it "here's the time in UTC right now". If it knows it's own timezone it'll do the rest.

also check hwclock(1) since you probably want to jump the hardware clock so when you reboot you're not way off again.
-c
 
Old 03-15-2007, 03:03 PM   #5
estratos
Member
 
Registered: Jan 2006
Distribution: Ubuntu
Posts: 85

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by cconstantine
date --utc MMDDhhmmCCYY.ss

take your local wallclock time, shift it to UTC. Then set the date on the remote system tell it "here's the time in UTC right now". If it knows it's own timezone it'll do the rest.

also check hwclock(1) since you probably want to jump the hardware clock so when you reboot you're not way off again.
-c
I've decided to parse /etc/TZ as it contains all the information I need. The downside is that it's a hard task for a so simple application.

Thanks all!

Daniel.
 
Old 03-15-2007, 03:47 PM   #6
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
Lads, use 'ntpdate' instead.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
Tiny Sofa 2.0 - I thought "halt", "reboot" were only root command ?? sorcerer Linux - Distributions 1 08-21-2004 03:28 PM
How to get the month in one digit instead of two digits in the "date" command? aadaileh Programming 7 02-05-2004 04:57 PM
"segmentation error" when issuing "useradd" command through terminal with RH 9.0 kaihuang Linux - General 0 10-21-2003 11:47 PM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:24 PM.

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