Jump to content

Need some help for this PHP script please!


L4ndy

Recommended Posts

Hi Folks,

 

I am quite a novice on PHP and scripting in general so, apologies in advance for not being specific on my question.

My query is, I have the following script:

 

function getFirstDayOfWeek($year, $weeknr)
{
$offset = date('w', mktime(0,0,0,1,1,$year));
$offset = ($offset < 5) ? 1-$offset : 8-$offset;
$monday = mktime(0,0,0,1,1+$offset,$year);

return strtotime('+' . ($weeknr - 1) . ' weeks', $monday);

 

It's part of a Resource booking system PHP script which basically allows users to book any resources for any given Day and Period. The main page of the system is divided into Weeks, days and periods.

Now the problem is that after a few weeks the starting day of the week sudenly became Sunday as oposed to Monday as you can see on the picture attached below. Is there anything obvious I need to change on the script to always make Monday the starting day of the week??

 

Thanks in advance

 

[attachment deleted by admin]

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.