Created
July 8, 2010 16:58
-
-
Save jrabbit/468303 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
daynum=int(time.strftime('%j')) | |
year=int(time.strftime('%y')) | |
composite=(year*365)+daynum | |
# def ordinal(num): | |
# ldig = num % 10 | |
# l2dig = ldig % 10 | |
# if l2dig == 1: | |
# suffix = 'th' | |
# elif ldig == 1: | |
# suffix = 'st' | |
# elif ldig == 2: | |
# suffix = 'nd' | |
# elif ldig == 3: | |
# suffix = 'rd' | |
# else: | |
# suffix = 'th' | |
# return '%d%s' % (num, suffix) | |
# #thanks David Zaslavsky. http://tinyurl.com/38ev44s | |
def ordinal(n): | |
if 10 <= n % 100 < 20: | |
return str(n) + 'th' | |
else: | |
return str(n) + {1 : 'st', 2 : 'nd', 3 : 'rd'}.get(n % 10, "th") | |
print "It is the %s day since President Bush declared mission accomplished in Iraq, \ | |
the %s day since he declared victory in the Afghanistan, \ | |
and %s day of the Deepwater Horizon disaster in the Gulf."% (ordinal(composite - 1214), ordinal(composite - 1625), ordinal(composite - 3759)) | |
#Composite dates - date of occurance for July 8th | |
#2625 Iraq | |
#2214 Afg | |
#80 Oil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment