• odium@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    That program better be using an existing date library, because otherwise it’s most definitely wrong.

      • al4s@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        5 months ago

        Don’t be ridiculous, that would never pass QA.

        But this one will. Joy for years to come:

        public string GetDayOfWeek(DateTime date) {
            return ((date - new DateTime(1970, 1, 1)).Milliseconds / 86400000) % 7 switch {
                0 => "Thursday",
                1 => "Friday",
                2 => "Saturday",
                3 => "Sunday",
                4 => "Monday"
            };
        }