The earliest date that can be stored in the datetime SQL field depends on the data type used:
datetime: 1753-01-01 through 9999-12-31 smalldatetime: 1900-01-01 through 2079-06-06 date, datetime2 and datetimeoffset: 0001-01-01 through 9999-12-31
See https://msdn.microsoft.com/en-GB/library/ms186724.aspx#DateandTimeDataTypes for more information.
epoch is useful if you convert numbers to dates, but are irrelevant if you save dates as dates.
If you do not want to deal with zeros correctly, the simple answer is to select a date that, as you know, will be in front of your data and hard code it in your request. cast('1900-01-01' as datetime) will work in most cases.
When using something like cast(0 as datetime) produces the same result, it hides what you did in your code. Someone supporting this, wondering where these strange old dates come from, will be able to quickly determine the speed of hard coding.
Stephen turner
source share