Hi Chris,

The following query should work for you.

select date_sub(date_col, interval weekday(date_col) day),
date_add(date_col, interval 6-weekday(date_col) day) from  table_name

Anvar.



At 07:20 PM 25/11/2001 -0500, you wrote:
>Hey all,
>
>I'm hoping someone can help me out with a little date/time problem I'm
>having. I've got a database full of timestamps that I want to group
>together based on their week. I can use the WEEK() function or
>DATE_FORMAT() to convert the timestamp to a week number, but I'd rather
>display the boundary dates for the week because I don't feel the week
>number is very informative.
>
>e.g. Given the timestamp '20011114095959' (a Wednesday), I would like to
>output '2001-11-12 to 2001-11-18' (which is Monday to Sunday).
>
>Is there a way using the date/time functions of MySQL to make this
>conversion in my SELECT statement? I haven't been able to figure out a
>way to get MySQL to use a week number to generate these boundary dates.
>
>I'm assuming the final SQL will look something like:
>SELECT CONCAT(function_to_get_monday, ' to ', function_to_get_sunday)...
>
>Any help is appreciated.
>
>--
>coop
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to