I'm running Raspbian on a Pi 2. While I'm not sure this behavior was different previously, running date outputs the same time as date -u, despite my timezone being UTC-7. Below is the output of both of the above commands, and my $TZ variable:

pi@raspberrypi ~ $ date; date -u; echo $TZ
Sat Oct  3 05:33:43 America 2015
Sat Oct  3 05:33:43 UTC 2015
America/Los Angeles

How can I change this output to show the correct time/date? (eg. Oct 2 10:33:43 America 2015 as the output for date)

  • 1
    I notice there is a space instead of an underscore in "Los Angeles"; not sure if that makes a difference, but tzselect output has an underscore in it....
    – Wildcard
    Oct 3, 2015 at 5:49

1 Answer 1


You have have the timezone set incorrect. To see if it works at all use some others (the extremes):

$ TZ=Pacific/Midway date
Mon Sep 28 20:42:02 SST 2015
$ TZ=Pacific/Kiritimati date
Tue Sep 29 21:42:48 LINT 2015

and if you double check your entry against the list you can see you're missing an underscore in the value of $TZ.

So try

$ TZ=America/Los_Angeles date

and see if your problem persists.

I haven't found any policy for the naming of the timezones, but spaces are never in them and replaced by underscore, but sometimes with a dash. It is probably best to look it up and copy/paste the value, something you, or your source didn't.

  • Looks like this is the cause of the issue, but simply exporting the right string doesn't seem to carry over after a system restart. /etc/timezone appears to have the correct string, but doesn't seem like it applies itself. Running dpkg-reconfigure tzdata seems to replace the underscore with a space as well. Oct 3, 2015 at 10:10
  • 1
    @Nightfirecat No exporting is not enough, but it is the way to test if you got the correct string without having to reboot. My system has no TZ set in the environment at all and still gets the correct timezone (from /etc/timezone, so it looks like one of the scripts executed on shell startup for you sets this incorrectly. Try unset TZ to see if that solves it.
    – Anthon
    Oct 3, 2015 at 10:14
  • Well, trick question -- looks like I exported the wrong TZ string in my .profile a while back and never realized it. My bad! :) Oct 3, 2015 at 10:14
  • @Nightfirecat I just edit my previous comments while you were commenting with exact that info.
    – Anthon
    Oct 3, 2015 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .