joel24 Posted January 1, 2011 Share Posted January 1, 2011 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..? Quote Link to comment https://forums.phpfreaks.com/topic/223111-setting-week-start-when-grouping/ Share on other sites More sharing options...
joel24 Posted January 2, 2011 Author Share Posted January 2, 2011 won't let me modify to fix up the URL, fixed mysql week URL Quote Link to comment https://forums.phpfreaks.com/topic/223111-setting-week-start-when-grouping/#findComment-1153742 Share on other sites More sharing options...
BLaZuRE Posted January 2, 2011 Share Posted January 2, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/223111-setting-week-start-when-grouping/#findComment-1153954 Share on other sites More sharing options...
joel24 Posted January 3, 2011 Author Share Posted January 3, 2011 hit the nail on the head! it is for a company's pay-roll I'll have a play around with it and see what I can do Quote Link to comment https://forums.phpfreaks.com/topic/223111-setting-week-start-when-grouping/#findComment-1154136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.