Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: Calculate Date when End date May Be Null

    I'm trying to calculate the number of days between EITHER date_added and date_removed OR between date_added and today if date_removed is null.

    It seems to me that I need, somehow, to get the timestamp returned by unix_timesamp(PR_DATE_ADDED) to be equal to today if it is null.

    Been going round in circle with this for a few hours and geeting somewhere.

    Using 3.22.

    Anyone any ideas?

  2. #2
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137

    Re: Calculate Date when End date May Be Null

    I think that 3.22 supports these functions:
    Code:
    SELECT TO_DAYS(IFNULL(date_removed, NOW())) - TO_DAYS(date_added), ...

  3. #3
    Join Date
    Feb 2004
    Posts
    2
    Thanks.

    Managed to get it working using the IFNULL statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •