0

I am trying to make a function that will check the time associated with a future event (cpt) with the current time, to see if the event has past. When I first collect the time it is in seconds and I can then convert it easily with date_i18n() to whatever, but I am not sure how to compare that results with the wordpress function the_time() to retrieve the current time.

Is there a way to have the_time() spit out the result in seconds, and I can then compare the two simply by ><= ?

or is there a way to compare two dates formatted in the same way? So formatting my date_i18n() result the same way as the_time() result and then comparing somehow

1 Answer 1

1

the_time() doesn't return the current time, it returns the time of the current post, also it echoes the result.

If you need the current time, simply use PHPs native time() function.

1
  • Thanks for your help, that accomplished exactly what I was looking for
    – Kyle
    Oct 12, 2012 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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