Title: current_time()
Last modified: August 18, 2016

---

# current_time()

 *  [marky](https://wordpress.org/support/users/marky/)
 * (@marky)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/current_time/)
 * I’m trying to write a small plugin to display messages on my site depending on
   the day. (My site is updated on a very strict schedule, and I want to display
   when the next post will appear)
 * Anyway, I’m using `current_time('timestamp')` to try and get the blog’s time 
   as set in the options (as opposed to GMT or the server’s time).
 * Unfortunately, it seems to be returning something very odd—neither the server’s
   time, nor GMT. Perhaps it’s the server’s time minus the GMT offset in the options
   page. Either way, it’s way off.
 * Am I doing something wrong? If there an easy way to get the time that’s configured
   in the WordPress options page?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/current_time/#post-475740)
 * `current_time('timestamp')` returns the time as a UNIX timestamp (that is, in
   seconds starting from 01/01/1970).
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 6 months ago](https://wordpress.org/support/topic/current_time/#post-475750)
 * Getting the timestamp like that is useful if you want to actually compare it 
   to some other timestamp (which you can generate from a string date/time by using
   the strtotime() function, or using one of the other PHP date/time functions).
 * If you want to display the time as a text string, then you should use current_time(‘
   mysql’) instead.
 * As for what it returns, current_time will be the server time + the offset in 
   the options page, and it will be equivalent to the time displayed on the options
   page itself.
 *  Thread Starter [marky](https://wordpress.org/support/users/marky/)
 * (@marky)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/current_time/#post-475755)
 * Sorry, I should have clarified; I’m feeding `current_time('timestamp')` into 
   the PHP `date` function to get the date. Specifically, for debug purposes, I’m
   echoing `date('l dS F Y h:i:s A', current_time('timestamp'))`.
 * It continues to return something extremely odd. As of 2006-11-07 14:00:00 GMT,
   for example, it was returning 2006-11-**06** 21:00:00. My GMT offset is -5 (i.
   e. EST). The server is on the west coast, but that still shouldn’t explain the
   wild difference I’m seeing.
 * Perhaps I should be adding the offset manually? I’m using Dreamhost, so I’d be
   very surprised if this is a server misconfiguration.
 *  Thread Starter [marky](https://wordpress.org/support/users/marky/)
 * (@marky)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/current_time/#post-475762)
 * My apologies; I think I understand why I’m getting the wild difference. I had
   set my GMT offset to -11 by accident (while debugging around), and since the 
   server is on the west coast, it was returning the time as PST – 11.
 * Now, that’s still not exactly what I’m looking for. I’m looking for GMT + offset.
   Is there a WP function that will give me that, or do I have to add gmt_offset()
   to the UTC time manually?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘current_time()’ is closed to new replies.

## Tags

 * [current_time](https://wordpress.org/support/topic-tag/current_time/)
 * [GMT](https://wordpress.org/support/topic-tag/gmt/)
 * [offset](https://wordpress.org/support/topic-tag/offset/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [marky](https://wordpress.org/support/users/marky/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/current_time/#post-475762)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
