HI Guys,

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

date
Wednesday, 19 August 2009 09:20:59 BST

But when I run

date -u '+%y%m%d.%H:%M:%S'
090819.08:21:27

My question is why is the second command an hour behind? In my environment the following are set:

LC_TIME=en_GB.ISO8859-15
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?

Recommended Answers

All 5 Replies

Great Britian has summer daylight savings time which means your clock is off by an hour.

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?

I have worked it out have used:

`date +"%Y.%m.%d.%H%M"`

Instead of date -u

Actually, the below command gives the time as per GMT :

date -u

where as on using

date

, we get the time according to what we have set our time zone (TZ) as.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.