treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Comparing Dates with Current Date

  • Hi all,

    I'm making a events listing for a WordPress theme. I've got everything working except, when I'm displaying the events. I can show upcoming events with this

    
    if($current_time > $raw_end_date){
        showstuff.....
    }
    

    Now this will show all the up coming dates, but not events on "todays date". I've tried to use the '>=' operator but it still doesn't show the 'todays date' event.

    Does anyone have any ideas for this?

  • How do you derive $current_time? If that and $raw_end_date are timestamps (time measured in seconds since 1st Jan 1970) then if, for example, $raw_end_date measures from 12am of the date in question, your conditional would return false as soon as $current_time is that date.