+ 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

3rd Jul 2018, 3:48 PM
Prakash Jain
Prakash Jain - avatar
6 Antworten
+ 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
6th Jul 2018, 6:06 PM
Mr. Bot
Mr. Bot - avatar
+ 4
7th Jul 2018, 7:50 AM
Mr. Bot
Mr. Bot - avatar
+ 4
oh shoot... i assumed monday on the starting date.. i think thats why we are facing this issue.. I will correct it soon
7th Jul 2018, 4:57 PM
Mr. Bot
Mr. Bot - avatar
+ 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
5th Jul 2018, 5:22 AM
Mr. Bot
Mr. Bot - avatar
+ 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
6th Jul 2018, 10:44 PM
Mr. Bot
Mr. Bot - avatar
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
6th Jul 2018, 5:29 AM
Prakash Jain
Prakash Jain - avatar