Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Does current_time('timestamp') have an issue?

I am trying to get the current_time('timestamp'), and instead of giving me my current time:

Jun 26 2013 14:30

It gives me:

Jun 26 2013 21:30

I tried to check the seconds, and it gives me:

1372282238

Which is correct for the time given, but not for the real current time. What's happening?

share|improve this question
add comment

2 Answers

The output of current_time('timestamp') should be

time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );

according to WP 3.5.2, so you should check your get_option( 'gmt_offset' ) settings.

Also current_time('timestamp', 1 ) should give you time().

share|improve this answer
    
Thanks +1 for the help. –  Franz Noel Jun 26 '13 at 22:11
    
you're welcome, the date/time stuff can be confusing in PHP and WP :-) –  birgire Jun 26 '13 at 22:16
add comment
up vote 0 down vote accepted

It's a WP non-code programming thinking error.

Under General Settings > Timezone

It should be set to your own timezone.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.