Problem using curdate() with mysql ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    #1

    Problem using curdate() with mysql ?

    Hi,

    I have an asp page running from a mysql db.
    A line in my asp code runs as follows:

    .........WHERE ShipDate >= curdate()

    This displays the data until 'shipdate' (from the database) is less
    than curdate(). The problem I have is that I need the data to appear
    until 7 days after the shipdate. I have tried things like curdate()+7,
    but this does not work. I have also tried Shipdate+7, but this returns
    incorrect records from the past ?


    Appreciate your help



    David
  • Bart Van der Donck

    #2
    Re: Problem using curdate() with mysql ?

    david@scene-double.co.uk (David) wrote in message news:<c178e3e8. 0309080347.7e25 326c@posting.go ogle.com>...[color=blue]
    > Hi,
    >
    > I have an asp page running from a mysql db.
    > A line in my asp code runs as follows:
    >
    > ........WHERE ShipDate >= curdate()
    >
    > This displays the data until 'shipdate' (from the database) is less
    > than curdate(). The problem I have is that I need the data to appear
    > until 7 days after the shipdate. I have tried things like curdate()+7,
    > but this does not work. I have also tried Shipdate+7, but this returns
    > incorrect records from the past ?[/color]

    You can't trust returned date values from non-valid input.
    You probably want someting like
    DATEADD("2000-12-01",INTERVAL 7 DAY)

    Also see:
    http://www.mysql.com/doc/en/Date_and...functions.html

    Bart

    Comment

    • Bart Van der Donck

      #3
      Re: Problem using curdate() with mysql ?

      david@scene-double.co.uk (David) wrote in message news:<c178e3e8. 0309080347.7e25 326c@posting.go ogle.com>...[color=blue]
      > Hi,
      >
      > I have an asp page running from a mysql db.
      > A line in my asp code runs as follows:
      >
      > ........WHERE ShipDate >= curdate()
      >
      > This displays the data until 'shipdate' (from the database) is less
      > than curdate(). The problem I have is that I need the data to appear
      > until 7 days after the shipdate. I have tried things like curdate()+7,
      > but this does not work. I have also tried Shipdate+7, but this returns
      > incorrect records from the past ?[/color]

      You can't trust returned date values from non-valid input.
      You probably want someting like
      DATEADD("2000-12-01",INTERVAL 7 DAY)

      Also see:
      http://www.mysql.com/doc/en/Date_and...functions.html

      Bart

      Comment

      • Bart Van der Donck

        #4
        Re: Problem using curdate() with mysql ?

        david@scene-double.co.uk (David) wrote in message news:<c178e3e8. 0309080347.7e25 326c@posting.go ogle.com>...[color=blue]
        > Hi,
        >
        > I have an asp page running from a mysql db.
        > A line in my asp code runs as follows:
        >
        > ........WHERE ShipDate >= curdate()
        >
        > This displays the data until 'shipdate' (from the database) is less
        > than curdate(). The problem I have is that I need the data to appear
        > until 7 days after the shipdate. I have tried things like curdate()+7,
        > but this does not work. I have also tried Shipdate+7, but this returns
        > incorrect records from the past ?[/color]

        You can't trust returned date values from non-valid input.
        You probably want someting like
        DATEADD("2000-12-01",INTERVAL 7 DAY)

        Also see:
        http://www.mysql.com/doc/en/Date_and...functions.html

        Bart

        Comment

        Working...