from ctypes import *
string=c_char*50
def convert(mm,dd,yy):
yy-=1900
ndays=long(30.42*(mm-1)+dd)
if mm==2:
ndays+=1
if mm>2 and mm<8:
ndays-=1
if yy%4==0 and mm<2:
ndays+=1
ncycles=yy/4
ndays+=ncycles*1461
nyears=yy%4
if nyears>0:
ndays+=365*nyears+1
if ndays>59:
ndays-=1
day=ndays%7
yy+=1900
if yy%4==0 and yy%400!=0:
day+=1
return day
class date(Structure):
_fields_=[('month',c_int),('day',c_int),('year',c_int)]
class person(Structure):
_fields_=[('name',string),('birthdate',date)]
student=[]
weekday=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
month=['January','February','March','April','May','June','July','August',\
'September','October','November','December']
name='Rob Smith'
birthdate=date(7,20,1972)
student.append(person(name,birthdate))
name='Judy Thompson'
birthdate=date(11,27,1983)
student.append(person(name,birthdate))
name='Jim Williams'
birthdate=date(12,29,1998)
student.append(person(name,birthdate))
name='Mort Davis'
birthdate=date(6,10,2010)
student.append(person(name,birthdate))
for count in xrange(0,4):
day_of_week=convert(student[count].birthdate.month,student[count].birthdate.day,student[count].birthdate.year)
print student[count].name,
print " %s, %s %d %d \n" %(weekday[day_of_week],month[student[count].birthdate.month-1],student[count].birthdate.day,student[count].birthdate.year)