sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
I have a column "time" with timestamps that look like 2006-08-10 10:48:21. I need to select them based on TODAY, THIS WEEK, THIS MONTH, etc.
I am currently using CURDATE(),INTERVAL $by ($by: 1 day, 7 day, etc) which I could probably get by with but it's not quite right. I don't want a "past 24 hours" select, I want a select from today since midnight. On the same token, I don't want the past 7 days, I want this week from Sunday. Same goes for the current month and year.
Selecting an interval on 1 year or even 365 days brings back a year from the current date, not the year of 2006.
I'm looking for non-modular solutions on how this could be pieced together.
2006-08-11 Retitled by planetscape, as per Monastery guidelines
Original title: 'parsing time in mysql'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (OT) parsing time in mysql
by Ieronim (Friar) on Aug 11, 2006 at 21:18 UTC | |
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 |