WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to store the current time using the update_option and then compare it if the set time was 3 days ago. I want to know in what format I should store the time? and then how can I compare it with current time and find the difference in the days?

share|improve this question
up vote 2 down vote accepted

You should store the time as a unix time stamp then you can use human_time_diff to compare.

echo human_time_diff( get_the_time('U'), current_time('timestamp') );

If the difference is more than 24 hours difference it will return the value in days.

share|improve this answer

Your Answer


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.