# \[SOLVED\] Timezone: "now" always refers to UTC?

**URL:** <https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721>\
**Category:** Beginners\
**Created:** [October 27, 2015, 8:36pm UTC](https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721 "2015-10-27T20:36:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SmartHome](https://community.openhab.org/user_avatar/community.openhab.org/smarthome/32/1142_2.png) [@SmartHome](https://community.openhab.org/u/SmartHome)\
**Post date:** [October 27, 2015, 8:36pm UTC](https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721/1 "2015-10-27T20:36:24Z")

</div>

Hey there!

I mentioned if I use “now” inside my rules it seems to be UTC always, not considering my timezone or daylight saving time. Same thing if I use charts the time is also UTC.  
My workaround currently is to hard-code time difference and use a switch to set or unset daylight saving time. This is a bit awkward.

Does openHAB offer anything to consider timezone and daylight saving time automatically?  
Currently I am using openHAB version 1.6.2.  
As I am new to openHAB I think this is a beginner issue. So thanks in advance.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 27, 2015, 8:47pm UTC](https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721/2 "2015-10-27T20:47:38Z")

</div>

Have you configured the timezone on your computer? I never had to do anything special on my machines to get it to use the local timezone.

When you use the `date`command, what timezone does it use? For example, I live in the US Mountain timezone so I get

```
Tue Oct 27 14:44:31 MDT 2015

```

The MDT stands for Mountain Daylight Time.

[Check out these instructions for how to set your timezone on Linux.](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html)

---

<div class="post-metadata">

**Author:** ![Kai](https://community.openhab.org/user_avatar/community.openhab.org/kai/32/116281_2.png) [@Kai](https://community.openhab.org/u/Kai)\
**Post date:** [October 28, 2015, 3:47am UTC](https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721/3 "2015-10-28T03:47:47Z")

</div>

[DateTime (Joda time 2.2 API)](http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTime.html#now()) says:  
“Obtains a DateTime set to the current system millisecond time […] in the default time zone.”

---

<div class="post-metadata">

**Author:** ![SmartHome](https://community.openhab.org/user_avatar/community.openhab.org/smarthome/32/1142_2.png) [@SmartHome](https://community.openhab.org/u/SmartHome)\
**Post date:** [October 28, 2015, 6:21pm UTC](https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721/4 "2015-10-28T18:21:38Z")

</div>

Thanks for the answers. I already checked my system time to be correct.  
date-command results in “Mi 28. Okt 19:19:15 CET 2015”.  
This is correct for me here in Germany.

Is there any difference between the system time and default time zone that joda-time refers to?  
I mentioned in joda time documentation that now can take timezone as argument as well. Will try this next.

---

<div class="post-metadata">

**Author:** ![SmartHome](https://community.openhab.org/user_avatar/community.openhab.org/smarthome/32/1142_2.png) [@SmartHome](https://community.openhab.org/u/SmartHome)\
**Post date:** [November 1, 2015, 1:46pm UTC](https://community.openhab.org/t/solved-timezone-now-always-refers-to-utc/3721/5 "2015-11-01T13:46:05Z")

</div>

Took some time today to investigate the issue and traced down the root cause:

1. My System time was set correct (thanks Rich for your hint)
2. Also joda time “now” was referring to the correct time for my timezone (thanks Kai for the info)

Problem was that I auto-start openHAB from “rc.local”. It seems that sytem time initialization is not complete and “now” gives UTC. If I start openHAB from system prompt then “now” uses correct time-zone.

Issue closed for me now, thanks!
