selecting record between dates

by skyvia
3 replies
I need to select record from a table in my database.the table field has a varchar type that holds date data.I want the records to be displayed according to the date selected by the user desc.The problem is that the record displays only data by the day and not by month.i want a chronological display of data.
#dates #record #selecting
  • Profile picture of the author KirkMcD
    What does a typical date look like in the table?
    {{ DiscussionBoard.errors[4377191].message }}
  • Profile picture of the author Bofu2U
    If it's just time() just do (for example, and assume you're talking about PHP/SQL):

    WHERE `timestamp` > '".(time() - (60*60*24))."'
    Would get you from 24 hours ago until now.

    time being current time, and 60*60*24 being -> 60 seconds, times 60 minutes, times 24 hours.
    {{ DiscussionBoard.errors[4377235].message }}
    • Profile picture of the author mjbaker
      You can use the date function in PHP to output the date in any format you choose.

      W3Schools has an explanation: PHP Date() Function

      Mike
      {{ DiscussionBoard.errors[4388794].message }}

Trending Topics