Jump to content

Recommended Posts

Hello,

 

I'm coding a budget application. Basically, the section of code I'm working on will check if today is the start of a new week and if so it will add the weeks budget to the current balance.

 

If today is > next week date
fetch budgeted amounts per week from each category and current balance
update category balance with current balance + budgeted amount
update next week date for next coming sunday

 

This piece of code will run every time the user visits the homepage. (Would this be easier to just use cron jobs?)

I'm stuck on what happens if the user doesn't visit the site for two weeks. It will only add one weeks budget to the balance.

 

Also, how would I calculate the date for the next coming sunday? I cannot use date + 7 as the user could visit on a tuesday, wednesday, etc.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/91390-calculating-if-its-a-new-week/
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.