Laurence Maddox
Laurence Maddox

Reputation: 11

debian squeeze cannot use local timezones no matter what you do

I need to use the CLI to see the time in arbitrary timezones. However, Debian doesn't respond to the recommended solution.

First, I set the local timezone.

dpkg-reconfigure tzdata

Then, I set the system time.

ntpdate pool.ntp.org

I update the hardware clock to reflect the system time.

hwclock --systohc --utc

Now, I follow this post: http://www.linuxquestions.org/questions/programming-9/display-different-timezones-in-command-line-927660/

Which says that I can complete my task using a command such as this: TZ=UTC date && TZ=CDT date && TZ=IST date

However, this is the output I get:

dpkg-reconfigure tzdata && ntpdate pool.ntp.org && hwclock --systohc --utc && TZ=UTC date && TZ=CDT date && TZ=IST date

Current default time zone: 'America/Chicago'
Local time is now:      Tue Apr 16 14:45:29 CDT 2013.
Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.

16 Apr 19:45:38 ntpdate[12036]: adjust time server 199.102.46.73 offset -0.036668 sec
Tue Apr 16 19:45:39 UTC 2013
Tue Apr 16 19:45:39 CDT 2013
Tue Apr 16 19:45:39 IST 2013

Upvotes: 0

Views: 798

Answers (1)

Celada
Celada

Reputation: 22261

CDT and IST aren't valid timezone names, so date is defaulting to show you UTC time if you attempt to use those as your timezone.

I'm not sure which timezones you actually meant to use, but try a couple of these. They are valid timezone names.

TZ=Asia/Shanghai date
TZ=America/Vancouver date
TZ=Europe/London date

Upvotes: 1

Related Questions