List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:August 14 1999 5:29pm
Subject:Re: simple timestamp question
View as plain text  
On Sun, 1999-08-15 00:00:01 -0700, Mick Hanna wrote:
        ^^^^^^^^^^
Ups, a time traveler? :)

> how do i select  rows from a timestamp column where date is today?
> 
> select * from table where dayofmonth(timestamp_column) = dayofmonth(now());

  SELECT * FROM table
  WHERE DATE_FORMAT(timestamp_column, 'Y-m-d') = CURRENT_DATE;

Or:

  SELECT * FROM table
  WHERE TO_DAYS(timestamp_column) = TO_DAYS(CURRENT_DATE);

The latter only works with dates after the year 1582.

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
simple timestamp questionMick Hanna14 Aug
  • Re: simple timestamp questionMartin Ramsch14 Aug