View Single Post

   
  #6 (permalink)  
Old 03-06-2008, 03:04 PM
Rik Wasmus
 
Posts: n/a
Default Re: Equivalent of MSSQL function DateFirst in MYSQL.

On Wed, 05 Mar 2008 17:56:50 +0100, Hetal <hetal.a.kapadia@gmail.com>
wrote:

> Hi..
>
> There is a function in MSSQL that sets you set what the first day of
> the week should be. For e.g. if i say Set DateFirst = 1, the first day
> of the week is set to Monday. If DateFirst = 2, then first day of the
> week is set to Tuesday.
>
> I would like to do something similar in MySQL but i am unable to find
> any equivalent function in MySQL. Your help will be very much
> appreciated.


SET @my_day_offset := 5;
SELECT (DAYOFWEEK(NOW()) + @my_day_offset) % 7;
SELECT (DAYOFWEEK('2008-03-03') + @my_day_offset) % 7;

Etc... define you own custom function for this if you want it, however, it
seems a very weird requitement to me. Why do you actually need this?
--
Rik Wasmus
Reply With Quote