Subject Casting as timestamp for dates prior to 30 December 1899
Author Steve White

Hi anyone

 

Using Firebird 2.5.1, dialect 1 I find these curiosities:

 

select cast('29-DEC-1899 23:59:59' as timestamp) from rdb$database returns ‘30/12/1899 12:00:01 AM’

 

select cast('29-DEC-1899 00:00:01' as timestamp) from rdb$database returns ‘30/12/1899 11:59:59 PM’

 

Any date prior to 30 December 1899 behaves in a similar way:

 

select cast('15-JUN-1832 9:14:21' as timestamp) from rdb$database returns ‘16/06/1832 2:45:39 PM’

 

Looks like two whole days are added and then the time component is being subtracted. Works correctly after 30 December 1899. Is this a known issue or am I doing something I shouldn’t?

 

Thanks,

 

Steve White