I figured it out, I'll have to have a go at working with leap years.
I know you can get the time like this:
1 | local a = tick() |
2 | local hour = math.floor(a/ 60 / 60 % 24 ) |
3 | local minute = math.floor(a/ 60 % 60 ) |
4 | local second = math.floor(a% 60 ) |
But what's the math to calculate the date?