Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Selecting Records by Date ?
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 wstarts 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







Report this thread to moderator Post Follow-up to this message
Old Post
Tony Benham
11-20-04 08:56 PM


Re: Selecting Records by Date ?
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 wstarts 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
>
>
>
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Tony Benham
11-20-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:23 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.