<p>Use <code>ini_get('date.timezone')</code>.</p>

<p>Source: <a href="http://php.net/manual/en/function.ini-get.php" rel="nofollow noreferrer">http://php.net/manual/en/function.ini-get.php</a></p>

CC BY-SA 3.0
2016-12-12T01:14:32.010Z
2016-12-12T01:14:32.010Z
Jameal G
<p>I'm setting up cron jobs from my plugin and I need to format the date in the server's time zone. It looks like Craft is overriding the timezone set in php.ini because PHP's <code>date_default_timezone_get()</code> always returns UTC. Is there another way to get the actual timezone set on the server?</p>

<plugin-development><datetime><timezone>
How can I get the server's timezone in a Craft plugin?
# How can I get the server's timezone in a Craft plugin?

(Asked by: username_0 on 2016-12-12)

I'm setting up cron jobs from my plugin and I need to format the date in the server's time zone. It looks like Craft is overriding the timezone set in php.ini because PHP's `date_default_timezone_get()` always returns UTC. Is there another way to get the actual timezone set on the server?

**Tags:** plugin-development, datetime, timezone

---

## 1 answers

### Answer by username_0 on 2016-12-12. Score: 1 | Accepted answer

Use `ini_get('date.timezone')`.

Source: <http://php.net/manual/en/function.ini-get.php>


---

