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]

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.