Skip to content

Instantly share code, notes, and snippets.

@sharuzzaman
Created March 27, 2018 06:46
Show Gist options
  • Save sharuzzaman/414f196a6ce003a2e76bc560e9192560 to your computer and use it in GitHub Desktop.
Save sharuzzaman/414f196a6ce003a2e76bc560e9192560 to your computer and use it in GitHub Desktop.
total working day in a month
#!/bin/env python
import calendar
import datetime
now = datetime.datetime.now()
cal = calendar.Calendar()
working_days = len([x for x in cal.itermonthdays2(now.year, now.month) if x[0] !=0 and x[1] < 5])
print "Total working days this month: " + str(working_days)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment