# \[Solved\] On the Pi the Time.zone not working

**URL:** <https://community.particle.io/t/solved-on-the-pi-the-time-zone-not-working/27550>\
**Category:** Raspberry Pi\
**Created:** [November 27, 2016, 9:28pm UTC](https://community.particle.io/t/solved-on-the-pi-the-time-zone-not-working/27550 "2016-11-27T21:28:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcomeau](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rcomeau/32/7593_2.png) [@rcomeau](https://community.particle.io/u/rcomeau)\
**Post date:** [November 27, 2016, 9:28pm UTC](https://community.particle.io/t/solved-on-the-pi-the-time-zone-not-working/27550/1 "2016-11-27T21:28:23Z")

</div>

Setting the Time.zone on the Pi has no effect. A time number displays as UTC, no zone adjustment.

My bad! Time.zone() is working on the Pi, it’s just that you don’t need it, the Pi clock is already set for the proper timezone and Time.zone() actually backs that up by 5 hours for my eastern timezone.

---

<div class="post-metadata">

**Author:** ![rcomeau](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rcomeau/32/7593_2.png) [@rcomeau](https://community.particle.io/u/rcomeau)\
**Post date:** [November 27, 2016, 9:19pm UTC](https://community.particle.io/t/solved-on-the-pi-the-time-zone-not-working/27550/2 "2016-11-27T21:19:03Z")

</div>

Just side note, that really I need to move to Raspberry Pi, but setting the Time.zone on the Pi has no effect. A time number displays as UTC, no zone adjustment.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [November 28, 2016, 8:07am UTC](https://community.particle.io/t/solved-on-the-pi-the-time-zone-not-working/27550/3 "2016-11-28T08:07:08Z")

</div>

> [@No com port being assigned to my (photon) devices](https://community.particle.io/t/no-com-port-being-assigned-to-my-photon-devices/27544/10):
>
> Just side note, that really I need to move to Raspberry Pi, but setting the Time.zone on the Pi has no effect. A time number displays as UTC, no zone adjustment.

I think that's the common behaviour.  
If you want a localized version of the epoch time, you'd use `Time.local()` instead of `Time.now()`.  
As `Time.now()` will always (irrespective of your `Time.zone()` setting) return the seconds since 1.1.1970 00:00 UTC.  
`Time.now()` in turn will return seconds since `1.1.1970 00:00` in your set time zone.

But all other functions (e.g. `hour()`, `timeStr()`, `format()`) expect a UTC based time to give you a correct result, since the localization happens internally.

* * *

_ScruffR:_  
I moved the unlrelated double post of this out of the other thread, to keep things "sorted".
