
select toDateTime64(-86400 ,9,'UTC') ==  1969-12-31 00:00:00.000000000

select toDateTime64(-86400.00 ,9,'UTC') ==  1970-01-01 00:00:00.000000000 


However, I expect both outputs to be same. 

Version affected : 22.8
{
        
        if constexpr (std::is_same_v<FromDataType, DataTypeFixedString>)
            while (!in.eof() && *in.position() == 0)
                ++in.position();
        if (in.eof())
            return true;
        
        if constexpr (std::is_same_v<ToDataType, DataTypeDate> || std::is_same_v<ToDataType, DataTypeDate32>)
        {
            if (!in.eof() && (*in.position() == ' ' || *in.position() == 'T'))
            {
                if (in.buffer().size() == strlen("YYYY-MM-DD hh:mm:ss"))
                    return true;
                if (in.buffer().size() >= strlen("YYYY-MM-DD hh:mm:ss.x")
                    && in.buffer().begin()[19] == '.')
                {
                    in.position() = in.buffer().begin() + 20;
                    while (!in.eof() && isNumericASCII(*in.position()))
                        ++in.position();
                    if (in.eof())
                        return true;
                }
            }
        }
        return false;
    }
    template <typename Additions = void *>
    static ColumnPtr execute(const ColumnsWithTypeAndName & arguments, const DataTypePtr & res_type, size_t input_rows_count,