ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to check if a given date has passed?

January 10, 2010 1:46pm

Subscribe [2]
  • #1 / Jan 10, 2010 1:46pm

    marega

    16 posts

    Hi guys!

    Ive been lurking around the forum for some time now. Im fairly new to codeigniter. So far its great!  Here we go.
    This is my first post so be gentle! =)

    I need a function that checks if a given date(‘Y-m-d’); has passed and returns TRUE or FALSE. But hoooooow?

  • #2 / Jan 10, 2010 5:32pm

    Udi

    58 posts

    You need to check if its a certain date?

    read about this function http://php.net/manual/en/function.date.php to know a bit more how it works, and take a look at this: http://ellislab.com/codeigniter/user-guide/helpers/date_helper.html

  • #3 / Jan 10, 2010 6:42pm

    marega

    16 posts

    No, I need to know if a given date, formated like this date(‘Y-m-d’),  is in the future or in the past.
    Thanks for the link.=)  However, I could not find any references on how to proceed.

  • #4 / Jan 10, 2010 7:23pm

    Craig A Rodway

    189 posts

    if( strtotime("2009-04-16") < time() ){
        // Your date is in the past
    } else {
        // Your date is not in the past
    }
  • #5 / Jan 11, 2010 3:09am

    marega

    16 posts

    AH! The time() function. That makes sense.
    There is plenty to be read on http://php.net/manual/en/function.time.php.

    Thank you Craig for exemplifying it for me.  Nice!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases