Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts

    mysql date operation problem??

    I am trying to display all the news which are up to todays date. I have used following query but didnt get the success
    PHP Code:
    $sql "SELECT * FROM news WHERE news_date < = todays_date"
    May be i have not enough knowledge about date operation in mysql. What i want is just your help .
    Thanks a lot.

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Did you look at Date and Time functions in the mysql manual to see how to do what you wanted?

  • #3
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts
    is there anyway to find the the week from yyyy-mm-dd format using mysql ?

  • #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Code:
    select week(yourdatecolumn)

  • #5
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Pardon again .i was not clear in my question
    Suppose what should i do if i would like to find the week on month of 2007-03-12 and the answer should be 2nd ie 2...
    thanks again


  •  

    Posting Permissions

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