LinuxQuestions.org
Review your favorite Linux distribution.
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
  Search this Thread
Old 09-04-2004, 07:35 AM   #1
hq4ever
Member
 
Registered: May 2004
Location: Israel
Distribution: Debian
Posts: 98

Rep: Reputation: 15
date command and the use of %Z tag


hello everyone,

I've read the man page for date on my fedora 2, there it says that [date] program get's it time zone definition from a few places.
I've checked my SET env -- no TZ there, i looked at /etc/localtime -- no go.
Now what i really don't understand is how to pass the "%Z" parameter back to date ?
-- could you please show me the correct syntax to use ?

Further more, why do i even need to pass it to date ? as far as i know time is a motherboard function -- why date need's to know my time zone? or does it calculate based on the time zone i pass to it the correct time to save on the mother board ?

if i talk too much - sorry - i'm new - please understand this
if you have intention to answer - thank you - please make it as detailed as you can - i really would like to understand this subject.

thanks, maxim.
 
Old 09-04-2004, 12:25 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Try

date +%Z

On my machine this returns

BST

Because I am in the UK and we are on "British Summer Time" = "BST". We go back to "Greenwich Mean Time" = "GMT" in the winter, and have to change all our clocks.

Date is quite complicated if you think about it, and remember that "Date" is also a sort of "Time".
Imagine a network of computers all around the world (Er, an "internet"?). In each place their LOCAL time is probably set to a different time, although they are all conected together "now". Suppose I send you an email at 16:00 my local time. You might receive it at 19:00 your local time. Did the email take 3hrs to reach you? No.

So linux needs timezones to adjust for local differences. Internally, it keeps a completely different measure of time, and this is translated into local time, or whatever you want, by the arguments you pass to date.

If I type date now I get:
Sat Sep 4 17:07:45 BST 2004
You would get something different, because you live a long way East of me.

But if we both typed date -u at the same time, we would get the same dates/times returned.

Hope this helps.
 
Old 09-04-2004, 01:15 PM   #3
hq4ever
Member
 
Registered: May 2004
Location: Israel
Distribution: Debian
Posts: 98

Original Poster
Rep: Reputation: 15
Yes it does, i also found this http://www.linux.org/docs/ldp/howto/...WTO/index.html link which helped me.

thank you.

Last edited by hq4ever; 09-04-2004 at 01:16 PM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
'date' command format Neorio Linux - General 3 01-18-2011 06:18 AM
Trying to do something wierd with the date command cboxall Linux - Newbie 2 07-22-2005 05:45 PM
date command aetucker1 Linux - General 3 01-21-2005 01:57 PM
can I use date command with mkdir? ewto Linux - General 6 06-16-2004 09:47 AM
help with Date command in script icw_sec Programming 6 01-06-2004 12:02 PM


All times are GMT -5. The time now is 04:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration