in reply to (OT) parsing time in mysql
SELECT * from `your_table_name` WHERE DAY(time) = DAY(NOW())
etc. will work.SELECT * from `your_table_name` WHERE YEAR(time) = YEAR(NOW()), DAYOFYEAR(time) = DAYOFYEAR(NOW())
MySQL has corresponding WEEK, YEAR and MONTH functions, too.
I assumed that you are using MySQL 4.1.1 or above. It not, use DATE_FORMAT with corresponding formatstring instead.
UPD:I wanted to give a quick and dirty answer, but this answer was TOO dirty :) Bug is now corrected.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: (OT) parsing time in mysql
by sulfericacid (Deacon) on Aug 12, 2006 at 00:18 UTC | |
by Ieronim (Friar) on Aug 12, 2006 at 06:21 UTC | |
by Bro. Doug (Monk) on Aug 12, 2006 at 07:21 UTC |