zero01alpha zero01alpha - 1 month ago 5
SQL Question

What unit of time/ date format is being used for the argument in this DATE function?

I'm having a hard time figuring out what date format I need to pass to this DATE() function on what I believe is an older T-SQL procedure.

As an example, It works in such a way that

ends up giving me
. It's not milliseconds, seconds, or days since the unix epoch. I'm totally confused on what unit of time or format this could be.


This would appear to be the number of days since 0001-00-00.

That said, I am not sure which calendar is being used for this purpose. However, on Postgres, the following:

select date('4036-02-27') - 1473811 * interval '1 day'

returns Dec 31 of the year 1 BC.

Note: I realize the question is tagged "tsql" and not "Postgres", but the date format does not seem to be a tsql standard format.