Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: comparing dates  (Read 4668 times)

0 Members and 1 Guest are viewing this topic.

12Strings

    Topic Starter


    Rookie

    • Experience: Experienced
    • OS: Windows 7
    comparing dates
    « on: May 20, 2015, 03:55:15 PM »
    Hi, I get:

    Fatal error: Can't use function return value in write context in C:\xampp\htdocs\

    from following code: I just want to determine "dayslate".
    //---------

    $dayslate = CURDATE() = DATE(duedate);

    // $dayslate = DATE(NOW()) - DATE(duedate);
    //---------
    // QUERY ON tablename TABLE
    $query = "SELECT dayslate,
    --------------------------------

    camerongray



      Expert
    • Thanked: 306
      • Yes
      • Cameron Gray - The Random Rambings of a Computer Geek
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Mac OS
    Re: comparing dates
    « Reply #1 on: May 20, 2015, 05:16:15 PM »
    What are you actually trying to do here?  You have:
    Code: [Select]
    $dayslate = CURDATE() = DATE(duedate);
    Are you sure you aren't meaning to subtract DATE(duedate) from CURDATE() rather than trying to set CURDATE() equal to DATE(duedate) which is what is causing the error.  Your code should probably be:
    Code: [Select]
    $dayslate = CURDATE() - DATE(duedate);