Why is 1899-12-30 the zero date in Access / SQL Server instead of 12/31?

后端 未结 3 1545
失恋的感觉
失恋的感觉 2020-11-27 06:37

More out of curiosity than any real problem; the question came up today and I know I\'ve seen 1899-12-30 used as a \"default\" date and a zero date in Access and older SQL S

3条回答
  •  庸人自扰
    2020-11-27 07:38

    SQL Server appears to return this date as a default if it cannot contact it's defined time source.

    I've had this happen during cluster failover incidents when my biometric time attendance system is running / being used.

    To defeat local clock manipulation, someone clocks in, I ask the SQL cluster instance what time it is.

    It can't get a valid active time source and returns this date.

    Workaround for me is straight forward by checking for this date in my GetServerTime Sub and using local PC time if this 'default' is returned.

    I've seen this with SQL 2000/2005/2008, all via ADO and VB6.

提交回复
热议问题