Jump to content

[SOLVED] How to calculate the day of the week by a given date.


Anzeo

Recommended Posts

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
?>

Link to comment
Share on other sites

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.