Finding difference in days

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?

Related posts

Leave a Reply

1 comment

  1. 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.