SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to get datewise results ?

    Hello,

    I have a database table in which I am storing records with unix timestamp.

    I now need to get records month wise and date wise. How do I do that ?

    In month wise I should get say all records that are of month June then it should so all the records of June, 2011.

    And when date wise it should then show all of the specific date.

    How to achieve ?

    Thanks.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Tapan View Post
    In month wise I should get say all records that are of month June then it should so all the records of June, 2011.
    Code:
    SELECT stuff
      FROM daTable
     WHERE yourcolumn >= UNIX_TIMESTAMP('2011-06-01')
       AND yourcolumn  < UNIX_TIMESTAMP('2011-07-01')
    simple, innit
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    Code:
    SELECT stuff
      FROM daTable
     WHERE yourcolumn >= UNIX_TIMESTAMP('2011-06-01')
       AND yourcolumn  < UNIX_TIMESTAMP('2011-07-01')
    simple, innit
    Hi,

    Thanks it was so easy.

    Thanks again.


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
  •