Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Day of Date Calculation

from datetime import datetime
dt=y,m,d=(2018,7,5)
dt=datetime(*dt)
w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday",]
print(w[dt.isoweekday()])

#to recall see calender
mc=[0,3,3,6,1,4,6,2,5,0,3,5,]
# (c%4)*5%7
cc=[0,5,3,1,]
import calendar
isl=calendar.isleap(y) and mc,y=divmod(y,100)
z=((cc[c%4]+ #century code
y//4+ #no of leap year
y+
mc[m-1] - isl + #month code and if leap sub 1 for first 2 months
d)
%7)
day=w[z-1]
print(day)


This post first appeared on SMARTMANOJ, please read the originial post: here

Share the post

Day of Date Calculation

×

Subscribe to Smartmanoj

Get updates delivered right to your inbox!

Thank you for your subscription

×