TheBrandon Posted May 30, 2012 Share Posted May 30, 2012 Hello all, I have a typical registration system where users can create accounts and the current time is stored in a TIMESTAMP field. I need to calculate how many people joined with the last 40 business days. What is the best way to achieve this? I found a few functions on php.net for calculating business days but all of the ones I found seem to deal primarily with the future, not the past. I really just need the single date. If I could just get a function that would return a 2012-05-24 21:11:49 type timestamp for the date 40 business days ago, I think I could take it from there, I'm just not sure what the most efficient way to calculate this is. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/263401-how-to-calculate-the-entries-within-the-last-40-business-days/ Share on other sites More sharing options...
TOA Posted May 30, 2012 Share Posted May 30, 2012 strtotime Alternately, if you're using MySQL date_sub Quote Link to comment https://forums.phpfreaks.com/topic/263401-how-to-calculate-the-entries-within-the-last-40-business-days/#findComment-1349932 Share on other sites More sharing options...
requinix Posted May 31, 2012 Share Posted May 31, 2012 Excluding holidays, 40 business days = 8 whole weeks. It's a rather convenient number. So no special logic required. Quote Link to comment https://forums.phpfreaks.com/topic/263401-how-to-calculate-the-entries-within-the-last-40-business-days/#findComment-1349975 Share on other sites More sharing options...
TheBrandon Posted May 31, 2012 Author Share Posted May 31, 2012 Excluding holidays, 40 business days = 8 whole weeks. It's a rather convenient number. So no special logic required. Wow, I didn't realize that lol. Thank you very much. Sometimes I guess you just need another mind looking at the problem! Have a great day, thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/263401-how-to-calculate-the-entries-within-the-last-40-business-days/#findComment-1350078 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.