Anzeo Posted July 7, 2007 Share Posted July 7, 2007 Hi all, finally back to coding. I've advanced quite a bit with my current project, but the time has come again I can't code my way any further. I'm currently working on a (simple) calendar system which allows registered users to add an event to the calendar. The table EVENT stores info about the author, date and description of the event. I then managed to output a list in which only events of this year are showed and are grouped together by months. And now I only need one more thing to complete the script. I want to output for every event on which day of the week it occurs (monday - sunday). I've looked around for tutorials but haven't found a basic one. Does anyone know how to accomplish this? Many thanks in advance! Quote Link to comment Share on other sites More sharing options...
Jewbilee Posted July 7, 2007 Share Posted July 7, 2007 if you know the number month, the number day, and the number year: echo date("l", mktime(0, 0, 0, $month, $day, year)); Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 7, 2007 Share Posted July 7, 2007 Just to add to that ... http://www.php.net/manual/en/function.date.php http://www.php.net/manual/en/function.mktime.php Quote Link to comment Share on other sites More sharing options...
Anzeo Posted July 7, 2007 Author Share Posted July 7, 2007 Works great, thanks a lot! Is their a quick way to translate the result to dutch? Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 7, 2007 Share Posted July 7, 2007 http://www.php.net/manual/en/function.setlocale.php - the very first example Quote Link to comment Share on other sites More sharing options...
Anzeo Posted July 7, 2007 Author Share Posted July 7, 2007 The setlocal doesn't seem to be working. I assume I'll have to use a switch or something like that to translate 'manually' ? I read somewhere that the language file has to be installed on the server in order for setlocal to be working? Quote Link to comment Share on other sites More sharing options...
Barand Posted July 7, 2007 Share Posted July 7, 2007 date('w') returns 0-6 (sun-sat) so you could use use an array of daynames if all else fails Quote Link to comment Share on other sites More sharing options...
Anzeo Posted July 7, 2007 Author Share Posted July 7, 2007 But when using the date function, I can't use a given specified date as the argument or can I? Quote Link to comment Share on other sites More sharing options...
Barand Posted July 7, 2007 Share Posted July 7, 2007 You have already seen that you can do that in an earlier post. I was just suggesting "w" instead of "l" and using an array such as this (only translated into Dutch equivalents) <?php $days = array('Sunday', 'Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday', 'Saturday'); $dow = date('w', strtotime('2007-07-07')); echo $days[$dow]; // Saturday ?> Quote Link to comment Share on other sites More sharing options...
Anzeo Posted July 7, 2007 Author Share Posted July 7, 2007 Thanks everyone got it working ^^! I'm going to study more on the date functions . Quote Link to comment 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.