Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi i have 2 dates , start_date and end_date for the month of November , i am trying to find the difference between these 2 dates excluding weekends ( ie Saturday and Sunday).
If u can provide example it will be great, i am using qliksense
Can u try :
end_date -start_date -( 2*(round((end_date -start_date )/7)))
example:
date('29/01/2018')-date('02/01/2018')-( 2*(round((date('29/01/2018')-date('02/01/2018'))/7)))
=> 19 days
or
date('29/01/2018')-date('02/01/2018')-( 2*(round((date('29/01/2018')-date('02/01/2018'))/7))) +1
=> 20 days
Use NetWorkDays() function
Can u try :
end_date -start_date -( 2*(round((end_date -start_date )/7)))
example:
date('29/01/2018')-date('02/01/2018')-( 2*(round((date('29/01/2018')-date('02/01/2018'))/7)))
=> 19 days
or
date('29/01/2018')-date('02/01/2018')-( 2*(round((date('29/01/2018')-date('02/01/2018'))/7))) +1
=> 20 days
But why this Omar, did I missing something from the initial post? Why can't we use NetWorkDays() here?
NetworkDays already eliminates the weekends? Didn't know that sorry !
It does, and I am amazed you have never used or heard about this function? Don't have to be sorry for anything, we are all learning new things... this is something new for you
Hi Sunny,
thanks for your help and the link , it really helped in learning new syntax as well
Hi Omar,
THis one really worked.
end_date -start_date -( 2*(round((end_date -start_date )/7)))
Thanks for all ur support and time