Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4.QtCore import QDate#using PyQt v4.9.1 on Python 2.7.3
- #release dates
- HL1=QDate(1998,11,19)#half life 1
- HL2=QDate(2004,11,16)#half life 2
- EP1=QDate(2006,06,01)#half life 2 - episode 1
- EP2=QDate(2007,10,10)#half life 2 - episode 2
- #approx. difference
- def Yrs(date1,date2):
- yrs=date2.year()-date1.year()
- dys=date2.dayOfYear()-date1.dayOfYear()
- if dys<0:yrs-=1;dys=date2.daysInYear()+dys
- ApxYr=yrs+(float(int(dys/365.*100)/100.))
- S2='~'+`ApxYr`+' years'
- Str= '('+`yrs`+' years, '+`dys`+' days. Or %s)'%S2
- return Str
- #release dates
- print 'Release dates (year, month, day):'
- print 'Half-Life \t\t:', HL1.getDate()
- print 'Half-Life 2\t\t:', HL2.getDate()
- print 'Half-Life 2: Episode 1\t:', EP1.getDate()
- print 'Half-Life 2: Episode 2\t:', EP2.getDate()
- print '\n'
- #number of days between
- print 'Number of days between:'
- print 'Half-Life and Half-Life 2\t:', HL1.daysTo(HL2),'days',Yrs(HL1,HL2)
- print 'Half-Life and HL2: Episode 1\t:', HL1.daysTo(EP1),'days',Yrs(HL1,EP1)
- print 'Half-Life and HL2: Episode 2\t:', HL1.daysTo(EP2),'days',Yrs(HL1,EP2)
- print 'Half-Life 2 and HL2: Episode 1\t:', `HL2.daysTo(EP1)`+' ','days',Yrs(HL2,EP1)
- print 'Half-Life 2 and HL2: Episode 2\t:', HL2.daysTo(EP2),'days',Yrs(HL2,EP2)
- print 'HL2:EP1 and HL2:EP2\t\t:', `EP1.daysTo(EP2)`+' ','days',Yrs(EP1,EP2)
- print '\n'
- # days between projected to future.
- print "Date of when the time waited for Half-Life 2: Episode 3 (or Half-Life 3) surpasses the amount of time waited between",
- print "(starting from HL2-EP2's release date):"
- print 'Half-Life and Half-Life 2\t:', EP2.addDays(HL1.daysTo(HL2)).getDate()
- print 'Half-Life and HL2: Episode 1\t:', EP2.addDays(HL1.daysTo(EP1)).getDate()
- print 'Half-Life and HL2: Episode 2\t:', EP2.addDays(HL1.daysTo(EP2)).getDate()
- print 'Half-Life 2 and HL2: Episode 1\t:',EP2.addDays(HL2.daysTo(EP1)).getDate()
- print 'Half-Life 2 and HL2: Episode 2\t:', EP2.addDays(HL2.daysTo(EP2)).getDate()
- print 'HL2:EP1 and HL2:EP2\t\t:', EP2.addDays(EP1.daysTo(EP2)).getDate()
- #http://forums.steampowered.com/forums/showthread.php?p=34986134#post34986134
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement