SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Dec 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to compare current date and expired date in MySQL query PHP

    Hi,

    I want to know that how can i compare current job and expired date from jobs by which if the expired date exceed the job will get hide ??
    I am confused can anyone kindly tell me the code for that ?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    WHERE CURDATE() <= jobexpiredate

    Something like that?

  3. #3
    SitePoint Member
    Join Date
    Dec 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup, i have done some how and that query is showing the dates which are <= current date but now i want to hide all the jobs which are expired how can i do that?

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    How do you know if they are expired?

  5. #5
    SitePoint Member
    Join Date
    Dec 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Through expired date

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,263
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by guido2004 View Post
    How do you know if they are expired?
    Quote Originally Posted by falak View Post
    Through expired date
    why am i not totally surprised
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    The where condition I posted gives you all rows with expiration date >= current date, which should be what you want?
    If your current query is showing the rows with expiration date <= current date, then change the operator from < to >


Bookmarks

Posting Permissions

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