+ 2
Python End Date time calculate based start date time and Duration exclude Non Working Hours
I would like to calculation End Date based on start date and Duration and working hours and day. For example: start date 01/01/2018 10:00 Duration: 40 hours End Date calculate Exclude non working hours. Working hours 10:00 to 18:00 and Sunday off. Is any packages available to get output? Please provide link based on this calculation
6 Respuestas
+ 4
I don't really understand what you did there,but here is a working code for you,
if you have any further query
feel free to ask
https://code.sololearn.com/cNPUUj5zzXMj/?ref=app
+ 4
so here is complete solution.
https://code.sololearn.com/cNPUUj5zzXMj/?ref=app
+ 4
oh shoot... i assumed monday on the starting date.. i think thats why we are facing this issue..
I will correct it soon
+ 2
you can do this with datetime module
just import datetime module,
convert your datetime into standard datetime object,
create a timedelta object after a little manipulation since you are only considering working hour and excluding sunday,
and finally add it to your date.
Hope it helps
+ 1
About the working hours, It does not matter whether you add lunch break or whatever, all we need is how many hours a day,
For the second part we will have to add a list of holiday dates which are not on sunday,
and and we can check how many holidays came in between our duration and accordingly find the end date
0
Final script to calculate end date time based on start date time, duration and office working hours.
https://code.sololearn.com/cgi8TIIGMgsG/?ref=app