The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

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){

    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

    This reply has been reported for inappropriate content.

    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.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed