Duane13 Posted May 4, 2009 Share Posted May 4, 2009 Hi all, Here is my dilemma: PHP Date's start of the week is Monday. Which would be fine for a European implementation but I require the start date to be Sunday. I checked all throughout PHP hoping to find a config for this to no avail. I am doing a rudimentary time allocation page based on week. So I am storing just week data as a string ie 2009W19, but Sunday is in Week 18. So my options are to write additional calculation code so it includes Sunday, changing our calendar pop up to begin on Mondays (not preferrable), or storing 2 dates (Sunday and Saturday). So I am just looking for some ideas thoughts or opinions on my options here. Thanks for your time, Duane Quote Link to comment https://forums.phpfreaks.com/topic/156784-php-date-start-of-the-week/ Share on other sites More sharing options...
ignace Posted May 4, 2009 Share Posted May 4, 2009 Use MySQL instead: SELECT DATE_FORMAT(NOW(), '%X'); Quote Link to comment https://forums.phpfreaks.com/topic/156784-php-date-start-of-the-week/#findComment-825633 Share on other sites More sharing options...
Duane13 Posted May 4, 2009 Author Share Posted May 4, 2009 I'm sorry I should have mentioned this earlier, the solution has to be applicable to both MySQL and PostGres Quote Link to comment https://forums.phpfreaks.com/topic/156784-php-date-start-of-the-week/#findComment-825670 Share on other sites More sharing options...
sasa Posted May 4, 2009 Share Posted May 4, 2009 look strftime() function Quote Link to comment https://forums.phpfreaks.com/topic/156784-php-date-start-of-the-week/#findComment-825749 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.