Home > Archive > PHP SQL > November 2004 > Selecting Records by Date ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Selecting Records by Date ?
|
|
|
|
| Tony Benham 2004-11-20, 3:56 pm |
| I realized my suggestion using w () is totally wrong. It will only work
when using absolute dates. My requirement is only to match the days/months
not years. So Mon->Sun will be different in each year for any particular
day,month.
So I need to find out which day of w it is today, find out the date for
last Monday, and the date for next Sunday, using GM dates, and select only
dob records which fall within that period, ignoring the year.
Thanks
Tony
"Tony Benham" <tonyb@kerrisway.freeserve.co.uk> wrote in message
news:3094usF2tohcmU1@uni-berlin.de...
> I'm trying to find a simple way of selecting records from a mysql database
> where the birthdate in the date field falls within the current w
> Mon-Sunday, so today 20th November should match records from 15th to 21st
> Nov.
> I tried using the mysql w function but this doesn't seem to work
> correctly for modes where w starts Mondays.
> I do something like
> SELECT surname,forename FROM player_info WHERE w (dob,3) =
> w (curdate(),3) (dob is date field in the table)
>
> On 20/11 it selects records correctly
>
> On 21/11 it should select the same records as query above, as the w
> number shouldn't alter until 22/11 which is the Monday.
>
> Is there another way of doing this ? A further complication is the mysql
> database is served on a US server, but I want all the calculations done
wrt
> to GMT.
>
> Tony
>
>
>
>
>
>
|
|
|
|
|