Advertisement
Guest User

Half life release dates and wait times

a guest
Oct 7th, 2013
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.09 KB | None | 0 0
  1. from PyQt4.QtCore import QDate#using PyQt v4.9.1 on Python 2.7.3
  2.  
  3. #release dates
  4. HL1=QDate(1998,11,19)#half life 1
  5. HL2=QDate(2004,11,16)#half life 2
  6. EP1=QDate(2006,06,01)#half life 2 - episode 1
  7. EP2=QDate(2007,10,10)#half life 2 - episode 2
  8.  
  9. #approx. difference
  10. def Yrs(date1,date2):
  11.     yrs=date2.year()-date1.year()
  12.     dys=date2.dayOfYear()-date1.dayOfYear()
  13.     if dys<0:yrs-=1;dys=date2.daysInYear()+dys
  14.     ApxYr=yrs+(float(int(dys/365.*100)/100.))
  15.     S2='~'+`ApxYr`+' years'
  16.     Str= '('+`yrs`+' years, '+`dys`+' days. Or %s)'%S2
  17.     return Str
  18.  
  19. #release dates
  20. print 'Release dates (year, month, day):'
  21. print 'Half-Life \t\t:', HL1.getDate()
  22. print 'Half-Life 2\t\t:', HL2.getDate()
  23. print 'Half-Life 2: Episode 1\t:', EP1.getDate()
  24. print 'Half-Life 2: Episode 2\t:', EP2.getDate()
  25. print '\n'
  26.  
  27. #number of days between
  28. print 'Number of days between:'
  29. print 'Half-Life and Half-Life 2\t:', HL1.daysTo(HL2),'days',Yrs(HL1,HL2)
  30. print 'Half-Life and HL2: Episode 1\t:', HL1.daysTo(EP1),'days',Yrs(HL1,EP1)
  31. print 'Half-Life and HL2: Episode 2\t:', HL1.daysTo(EP2),'days',Yrs(HL1,EP2)
  32. print 'Half-Life 2 and HL2: Episode 1\t:', `HL2.daysTo(EP1)`+' ','days',Yrs(HL2,EP1)
  33. print 'Half-Life 2 and HL2: Episode 2\t:', HL2.daysTo(EP2),'days',Yrs(HL2,EP2)
  34. print 'HL2:EP1 and HL2:EP2\t\t:', `EP1.daysTo(EP2)`+' ','days',Yrs(EP1,EP2)
  35. print '\n'
  36.  
  37. # days between projected to future.
  38. print "Date of when the time waited for Half-Life 2: Episode 3 (or Half-Life 3) surpasses the amount of time waited between",
  39. print "(starting from HL2-EP2's release date):"
  40. print 'Half-Life and Half-Life 2\t:', EP2.addDays(HL1.daysTo(HL2)).getDate()
  41. print 'Half-Life and HL2: Episode 1\t:', EP2.addDays(HL1.daysTo(EP1)).getDate()
  42. print 'Half-Life and HL2: Episode 2\t:', EP2.addDays(HL1.daysTo(EP2)).getDate()
  43. print 'Half-Life 2 and HL2: Episode 1\t:',EP2.addDays(HL2.daysTo(EP1)).getDate()
  44. print 'Half-Life 2 and HL2: Episode 2\t:', EP2.addDays(HL2.daysTo(EP2)).getDate()
  45. print 'HL2:EP1 and HL2:EP2\t\t:', EP2.addDays(EP1.daysTo(EP2)).getDate()
  46.  
  47. #http://forums.steampowered.com/forums/showthread.php?p=34986134#post34986134
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement