Grow your CSS skills. Land your dream job.

Comparing Dates with Current Date

  • # September 9, 2012 at 12:17 pm

    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?

    # September 9, 2012 at 3:57 pm

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".