Jump to content

Recommended Posts

Hi,

Has anyone else has stumbled across this problem? MySQL's <url=http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_week]week[/url] function only allows for the week start to be Monday or Sunday.

 

How could I allow the user to set a week start day of any day and then group by the user specified week for reporting..?

Link to comment
https://forums.phpfreaks.com/topic/223111-setting-week-start-when-grouping/
Share on other sites

Maybe use php date() function to determine which day returns the weekday you want.  Then, you'll be able to increase the date by 7 days and use that day in your queries and count which week of the year it is.  I don't see a real need for anything like that except if you're doing workweeks.  In that case, you might building a full fledged application that needs to worry about DST, leap years and seconds, salary vs hourly, pay periods vs work weeks, etc.  Sorry, venting  :D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.