Last active
February 15, 2017 14:27
-
-
Save r4dian/158fc45e1594a19a5f23f970ac51635a to your computer and use it in GitHub Desktop.
This file contains 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
var d = new Date('2013-03-14') | |
var n = new Date() | |
var year = Math.floor( Math.ceil( Math.abs( n.getTime()-d.getTime() ) / (1000 * 60 * 60 * 24) ) / 365 +1 ) | |
function nth(n){return["st","nd","rd"][((n+90)%100-10)%10-1]||"th"} | |
console.log("It is the " + year + nth(year) + " Year of Luigi") |
This file contains 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
from datetime import date | |
import math | |
n = (date.today()-date(2013,3,14)).days / 365 +1 | |
ordinal = lambda n: "%d%s" % (n,"tsnrhtdd"[(math.floor(n/10)%10!=1)*(n%10<4)*n%10::4]) | |
print ( 'It is the', ordinal(int(n)), 'Year of Luigi' ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment