Title: time() wrong inside WordPress
Last modified: August 21, 2016

---

# time() wrong inside WordPress

 *  Resolved [eminozlem](https://wordpress.org/support/users/eminozlem/)
 * (@eminozlem)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/time-wrong-inside-wordpress/)
 * php’s time() strangely outputs wrong when called inside WordPress.
 * I’m pretty sure my server time is setup correctly both Linux & php.
    The correct
   timezone for me is UTC+2. For example let’s say the time is 10:50 linux time:
   10:50 php time(): 10:50 inside wp time(): 8:50
 * My timezone setting in wp is also correctly set to Europe. I wonder why this 
   is happening any ideas ?
 * Here’s a screenshot (dont mind the minutes screenshots taken in between): [http://s29.postimg.org/4s80u06nb/wptimmm.jpg](http://s29.postimg.org/4s80u06nb/wptimmm.jpg)
 * PS: I avoid this confusion by using `$now = current_time( 'timestamp', 0 );` 
   but I don’t want to run an extra function for such a simple thing every time.

Viewing 1 replies (of 1 total)

 *  Thread Starter [eminozlem](https://wordpress.org/support/users/eminozlem/)
 * (@eminozlem)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/time-wrong-inside-wordpress/#post-4640795)
 * Ok to answer my own question; turns out WP uses UTC regardless of your local 
   timezone preference and I’ve read that it might cause issues if you change that
   in wp-settings ([link](http://weston.ruter.net/2013/04/02/do-not-change-the-default-timezone-from-utc-in-wordpress/)).
 * As much as I hate it, it seems I’ll have to keep using `current_time( 'timestamp',
   0 );` just to make sure.
 * I really hope in the future this’s solved in some way so that you can safely 
   assume that time() will always be your server (php)’s time.

Viewing 1 replies (of 1 total)

The topic ‘time() wrong inside WordPress’ is closed to new replies.

## Tags

 * [time](https://wordpress.org/support/topic-tag/time/)
 * [timezone](https://wordpress.org/support/topic-tag/timezone/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [eminozlem](https://wordpress.org/support/users/eminozlem/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/time-wrong-inside-wordpress/#post-4640795)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
