1

There is a function called datefirst in SQL that allow you to set what the first day of the week should be.So is there any equivalent function in Mysql?

User129
  • 129
  • 1
  • 1
  • 9
  • 1
    Does this help? http://stackoverflow.com/questions/3317980/getting-first-day-of-the-week-in-mysql-using-week-no – Alberto Gaona Nov 06 '12 at 05:23
  • That post was for getting the first day of the week. But here i need to set the first day of the week as monday in Mysql. – User129 Nov 06 '12 at 08:02

1 Answers1

1

Have a look at WEEK (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_week) - from the manual: The two-argument form of WEEK() enables you to specify whether the week starts on Sunday or Monday.

Alternatively you can also look at WEEKDAY (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_weekday) or DAYOFWEEK (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_dayofweek)

Rainer.R
  • 458
  • 2
  • 8
  • Thanks for your response for this post. but still i didn't get exact result as like Sql after going through these links. – User129 Nov 06 '12 at 07:59