Richard Jones' Log: Timezone fun

Wed, 20 Aug 2008

Just setting up some convenience aliases so I can deal better with timezones, I discovered this ...

rjones@l-rjones:$ TZ=BST date
Wed Aug 20 05:13:00 UTC 2008
rjones@l-rjones:~$ TZ=GB date
Wed Aug 20 06:13:40 BST 2008
rjones@l-rjones:~$

So it doesn't recognise the timezone TZ=BST but it displays the Great Britain time as "BST" :)

The convenience aliases, BTW, are:

alias edate="TZ=US/Eastern date"
alias wdate="TZ=US/Western date"
alias ukdate="TZ=GB date"

'cos I'm sick of trying to do this in my head (and getting it wrong) and because the few GUI programs out there suck.

Comment by Toby on Wed, 20 Aug 2008

I suspect that that's because BST isn't a timezone.

Comment by Josh Smith on Wed, 10 Sep 2008

It's even worse on my computer, it gives no indication that it doesn't recognize the timezone you've entered:
$ TZ=Etc/UTC date
Wed Sep 10 21:21:20 UTC 2008
$ TZ=BST date
Wed Sep 10 21:21:25 BST 2008
$ TZ=GB date
Wed Sep 10 22:21:28 BST 2008
$ TZ=ClearlyInvalid date
Wed Sep 10 21:21:41 ClearlyInvalid 2008

I love your idea for the aliases, and have copied a set of them to my .bashrc. But what is US/Western (I don't have that entry in my computer's tz database, and I'm just curious which of the US's westerly timezones it refers to)?

Comment by Richard Jones on Wed, 10 Sep 2008

Yeah, I think I made that one up :)

Comment by Hal on Tue, 21 Oct 2008

Not sure if this is the reason, but GB (and the whole of the UK, for that matter) runs on BST during summer and GMT during winter... so if you set your clock to BST, it would be wrong starting at the end of October when the clocks change. Much better to set it to a "meta" time zone for the geographical region and have the clock report BST or GMT as appropriate.