Why does `date` show UTC time, even with a different timezone set?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
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
)
date timezone
add a comment |
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
)
date timezone
1
I notice there is a space instead of an underscore in "Los Angeles"; not sure if that makes a difference, buttzselect
output has an underscore in it....
– Wildcard
Oct 3 '15 at 5:49
add a comment |
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
)
date timezone
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
)
date timezone
date timezone
edited Mar 9 at 13:02
Rui F Ribeiro
41.9k1483142
41.9k1483142
asked Oct 3 '15 at 5:39
NightfirecatNightfirecat
12315
12315
1
I notice there is a space instead of an underscore in "Los Angeles"; not sure if that makes a difference, buttzselect
output has an underscore in it....
– Wildcard
Oct 3 '15 at 5:49
add a comment |
1
I notice there is a space instead of an underscore in "Los Angeles"; not sure if that makes a difference, buttzselect
output has an underscore in it....
– Wildcard
Oct 3 '15 at 5:49
1
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 '15 at 5:49
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 '15 at 5:49
add a comment |
1 Answer
1
active
oldest
votes
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 simplyexport
ing 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. Runningdpkg-reconfigure tzdata
seems to replace the underscore with a space as well.
– Nightfirecat
Oct 3 '15 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. Tryunset TZ
to see if that solves it.
– Anthon
Oct 3 '15 at 10:14
Well, trick question -- looks like I exported the wrongTZ
string in my .profile a while back and never realized it. My bad! :)
– Nightfirecat
Oct 3 '15 at 10:14
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f233637%2fwhy-does-date-show-utc-time-even-with-a-different-timezone-set%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 simplyexport
ing 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. Runningdpkg-reconfigure tzdata
seems to replace the underscore with a space as well.
– Nightfirecat
Oct 3 '15 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. Tryunset TZ
to see if that solves it.
– Anthon
Oct 3 '15 at 10:14
Well, trick question -- looks like I exported the wrongTZ
string in my .profile a while back and never realized it. My bad! :)
– Nightfirecat
Oct 3 '15 at 10:14
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
add a comment |
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 simplyexport
ing 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. Runningdpkg-reconfigure tzdata
seems to replace the underscore with a space as well.
– Nightfirecat
Oct 3 '15 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. Tryunset TZ
to see if that solves it.
– Anthon
Oct 3 '15 at 10:14
Well, trick question -- looks like I exported the wrongTZ
string in my .profile a while back and never realized it. My bad! :)
– Nightfirecat
Oct 3 '15 at 10:14
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
add a comment |
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.
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.
edited Oct 3 '15 at 6:25
answered Oct 3 '15 at 6:18
AnthonAnthon
61.5k17107170
61.5k17107170
Looks like this is the cause of the issue, but simplyexport
ing 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. Runningdpkg-reconfigure tzdata
seems to replace the underscore with a space as well.
– Nightfirecat
Oct 3 '15 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. Tryunset TZ
to see if that solves it.
– Anthon
Oct 3 '15 at 10:14
Well, trick question -- looks like I exported the wrongTZ
string in my .profile a while back and never realized it. My bad! :)
– Nightfirecat
Oct 3 '15 at 10:14
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
add a comment |
Looks like this is the cause of the issue, but simplyexport
ing 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. Runningdpkg-reconfigure tzdata
seems to replace the underscore with a space as well.
– Nightfirecat
Oct 3 '15 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. Tryunset TZ
to see if that solves it.
– Anthon
Oct 3 '15 at 10:14
Well, trick question -- looks like I exported the wrongTZ
string in my .profile a while back and never realized it. My bad! :)
– Nightfirecat
Oct 3 '15 at 10:14
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
Looks like this is the cause of the issue, but simply
export
ing 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.– Nightfirecat
Oct 3 '15 at 10:10
Looks like this is the cause of the issue, but simply
export
ing 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.– Nightfirecat
Oct 3 '15 at 10:10
1
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 '15 at 10:14
@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 '15 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! :)– Nightfirecat
Oct 3 '15 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! :)– Nightfirecat
Oct 3 '15 at 10:14
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
@Nightfirecat I just edit my previous comments while you were commenting with exact that info.
– Anthon
Oct 3 '15 at 10:16
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f233637%2fwhy-does-date-show-utc-time-even-with-a-different-timezone-set%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 '15 at 5:49