date command

Thread Solved

Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

date command

 
0
  #1
Aug 19th, 2009
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?
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: date command

 
0
  #2
Aug 19th, 2009
Great Britian has summer daylight savings time which means your clock is off by an hour.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: date command

 
0
  #3
Aug 19th, 2009
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?
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: date command

 
0
  #4
Aug 19th, 2009
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.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: date command

 
0
  #5
Aug 19th, 2009
I have worked it out have used:
Shell Scripting Syntax (Toggle Plain Text)
  1. `date +"%Y.%m.%d.%H%M"`
Instead of date -u
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 12
Reputation: iceman29 is an unknown quantity at this point 
Solved Threads: 2
iceman29's Avatar
iceman29 iceman29 is offline Offline
Newbie Poster

Re: date command

 
0
  #6
Aug 26th, 2009
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.
Learn to appreciate and appreciate to learn.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC