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!

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.