C
|
cgphp 7/1/2013 |
I have made some changes to your code. Please, check the code below. $start = new DateTime("2013-01-01");
|
S
|
Sergej author 7/2/2013 |
I have made some changes to your code. Please, check the code below. Let me do an example. Start date: 2013-01-01 End date: 2013-01-31 Using your code the total days substracted are eight (01-01, 05-01, 12-01, 13-01, 19-01, 20-01, 26-01, 27-01). $start = new DateTime("2013-01-01");
|
C
|
cgphp 7/2/2013 |
Replace this statement: if(in_array($dt->format('d-m-Y'), $holidays))
if(in_array($dt->format('d-m'), $holidays))
next();
next($period); |
S
|
Sergej author 7/3/2013 |
thank you Christian - my problem was two part mostly stupidity for not refreshing cache...and also had part of the custom code on list page leftover from previous tryouts - that's why i got the wrong calculations. I have modified the code as per your inputs - thnx again and made slight changes - as per variable holidays like easter monday - would like to automate calculations for them but must see how it is to be done. So far variable holidays must be added manualy in appropriate array. Anyways, if anyone find some use for this - here it is - custom code on list page which calculates spent vaccation days between two dates - excluding weekends and holidays! $start = new DateTime($data["Od"]); |