SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot websalacarta's Avatar
    Join Date
    May 2003
    Location
    Spain
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    another question about timestamp...

    Hi,
    sorry for another question about this, but Iīve not found the solution to it searching on the forum.

    I have one column like this
    Code:
    mydate timestamp NOT NULL default CURRENT_TIMESTAMP
    I want to select the rows with mydate = one day

    Iīve tried:
    Code:
    SELECT...
    WHERE mydate>= '06/04/2008 00:00:00'
    AND mydate < '06/04/2008 23:59:59'
    
    SELECT...
    WHERE DATE(mydate) = '06/04/2008'
    They donīt work.
    Maybe itīs not a good idea to use one timestamp column for this...

    any idea?

    thanks for your time

  2. #2
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Staffordshire, UK & Florida, USA
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Format your comparison date as 'YYYY-MM-DD':

    Code:
    ... DATE(mydate) = '2008-04-06'

  3. #3
    SitePoint Zealot websalacarta's Avatar
    Join Date
    May 2003
    Location
    Spain
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    upppppssss...
    I&#180;ve been 2 hours looking for the solution

    thanks very much!


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
  •