943,822 Members | Top Members by Rank

Ad:
Aug 19th, 2009
0

date command

Expand Post »
HI Guys,

Prob a very simple one but im stumped, I run the following command and get:

Shell Scripting Syntax (Toggle Plain Text)
  1. date
  2. Wednesday, 19 August 2009 09:20:59 BST
But when I run
Shell Scripting Syntax (Toggle Plain Text)
  1. date -u '+%y%m%d.%H:%M:%S'
  2. 090819.08:21:27

My question is why is the second command an hour behind? In my environment the following are set:
Shell Scripting Syntax (Toggle Plain Text)
  1. LC_TIME=en_GB.ISO8859-15
  2. TZ=GB
I have tried it on a different server with exactly the same commands and env variables and get the correct result, what am I doing wrong here?
Similar Threads
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Aug 19th, 2009
0

Re: date command

Great Britian has summer daylight savings time which means your clock is off by an hour.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Aug 19th, 2009
0

Re: date command

hi,

But why does the date command give me the correct date then when I try and use the date -u command does it suddenly consider day light savings?
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Aug 19th, 2009
0

Re: date command

Please see this site:
http://wwp.greenwichmeantime.com/

It doesn't make sense to me either but it seems like that is probably a law in GB.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Aug 19th, 2009
0

Re: date command

I have worked it out have used:
Shell Scripting Syntax (Toggle Plain Text)
  1. `date +"%Y.%m.%d.%H%M"`
Instead of date -u
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Aug 26th, 2009
0

Re: date command

Actually, the below command gives the time as per GMT :
Shell Scripting Syntax (Toggle Plain Text)
  1. date -u

where as on using
Shell Scripting Syntax (Toggle Plain Text)
  1. date
, we get the time according to what we have set our time zone (TZ) as.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
iceman29 is offline Offline
12 posts
since Feb 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Issue with sed and date variable - Suffix too large - 512 max
Next Thread in Shell Scripting Forum Timeline: script to run java program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC