LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   "date" command and timezones (https://www.linuxquestions.org/questions/linux-general-1/date-command-and-timezones-537361/)

estratos 03-14-2007 06:26 AM

"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.

mitchell7man 03-14-2007 11:42 PM

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

estratos 03-15-2007 06:27 AM

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.

cconstantine 03-15-2007 08:47 AM

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

estratos 03-15-2007 03:03 PM

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.

ramram29 03-15-2007 03:47 PM

Lads, use 'ntpdate' instead.


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