It varies by database, each has a default time span.
SQL Server's default time span is: 1950-2049
, so 50
becomes 1950
, but 49
becomes 2049
.
In MySQL and Oracle it's 1970-2069
In Postgresql it's centered on 2020
, so whichever year is closest to 2020, which seems to also be 1970-2069
All of the defaults span into the future and therefore custom criteria is frequently necessary.
Two digit years can be confused, take 2010-05-07
and change it to a 2-digit year, 10-05-07
? Nope, should be 05-07-10
, at least in SQL Server:
SELECT CAST('2010-05-07' AS DATE) -- 2010-05-07
,CAST('10-05-07' AS DATE) -- 2007-10-05
,CAST('05-07-10' AS DATE) -- 2010-05-07
Invalid dates make it easy to determine the supplied date format usually.