1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Get rows whose date is within 72 hours?

Discussion in 'MySQL' started by Octane, Jul 13, 2011.

  1. #1
    Hi guys!

    I'm trying to grab all rows whose "date of stay" is within a 72 hour period.

    So, if you went to your calendar and looked at todays date, you'd be looking for all events within the next three days.

    The field stay_date is of type timestamp, just to head off the obvious question.

    I've got all of the query in place, except the WHERE clause for the aforementioned.

    Any ideas?
     
    Octane, Jul 13, 2011 IP
  2. dazst

    dazst Active Member

    Messages:
    115
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    78
    #2

    SELECT ... WHERE stay_date BETWEEN unix_timestamp() AND unix_timestamp() + (72 * 3600)
     
    dazst, Jul 13, 2011 IP
  3. Octane

    Octane Peon

    Messages:
    117
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Dazst, thanks for the prompt response!

    Given that I'm on a tight schedule, I had to forge on and figured out an alternate solution:
    But thanks all the same!
     
    Octane, Jul 13, 2011 IP