```
milovidov-desktop :) SELECT toString(toDateTime('-922337203.6854775808', 1))

SELECT toString(toDateTime('-922337203.6854775808', 1))

Query id: 3d51ba80-4993-4f64-b6ef-da0c0f1bdf43

┌─toString(toDateTime('-922337203.6854775808', 1))─┐
│ 2106-02-07 :rE:�.6                                │
└──────────────────────────────────────────────────┘
```
{
        bool monday_first_mode = week_mode & static_cast<UInt8>(WeekModeFlag::MONDAY_FIRST);
        if (monday_first_mode)
        {
            return toFirstDayNumOfWeek(d);
        }
        else
        {
            return (toDayOfWeek(d) != 7) ? DayNum(d - toDayOfWeek(d)) : d;
        }
    }
    /*
     * check and change mode to effective
     */
    inline UInt8 check_week_mode(UInt8 mode) const
    {
        UInt8 week_format = (mode & 7);
        if (!(week_format & static_cast<UInt8>(WeekModeFlag::MONDAY_FIRST)))
            week_format ^= static_cast<UInt8>(WeekModeFlag::FIRST_WEEKDAY);
        return week_format;
    }
    /*
     * Calc weekday from d
     * Returns 0 for monday, 1 for tuesday ...
     */
    inline unsigned calc_weekday(DayNum d, bool sunday_first_day_of_week) const