-- { echo } -- These values are within the extended range of DateTime64 [1925-01-01, 2284-01-01) SELECT toTimeZone(toDateTime(-2, 2), 'Asia/Istanbul'); 1970-01-01 01:59:58.00 SELECT toDateTime64(-2, 2, 'Asia/Istanbul'); 1970-01-01 01:59:58.00 SELECT CAST(-1 AS DateTime64(0, 'Asia/Istanbul')); 1970-01-01 01:59:59 SELECT CAST('2020-01-01 00:00:00.3' AS DateTime64(0, 'Asia/Istanbul')); 2020-01-01 00:00:00 SELECT toDateTime64(bitShiftLeft(toUInt64(1), 33), 2, 'Asia/Istanbul') FORMAT Null; SELECT toTimeZone(toDateTime(-2., 2), 'Asia/Istanbul'); 1970-01-01 02:00:00.00 SELECT toDateTime64(-2., 2, 'Asia/Istanbul'); 1970-01-01 02:00:00.00 SELECT toDateTime64(toFloat32(bitShiftLeft(toUInt64(1),33)), 2, 'Asia/Istanbul'); 2106-02-07 09:28:16.00 SELECT toDateTime64(toFloat64(bitShiftLeft(toUInt64(1),33)), 2, 'Asia/Istanbul') FORMAT Null; -- These are outsize of extended range and hence clamped SELECT toDateTime64(-1 * bitShiftLeft(toUInt64(1), 35), 2, 'Asia/Istanbul'); 1900-01-01 01:56:56.00 SELECT CAST(-1 * bitShiftLeft(toUInt64(1), 35) AS DateTime64(3, 'Asia/Istanbul')); 1900-01-01 01:56:56.000 SELECT CAST(bitShiftLeft(toUInt64(1), 35) AS DateTime64(3, 'Asia/Istanbul')); 2299-12-31 23:59:59.000 SELECT toDateTime64(bitShiftLeft(toUInt64(1), 35), 2, 'Asia/Istanbul'); 2299-12-31 23:59:59.00