• Ephera
    link
    fedilink
    62 months ago

    Yep, my immediate thought was, how the hell would you know it works?

    • @[email protected]
      link
      fedilink
      32 months ago

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

      • @[email protected]
        link
        fedilink
        3
        edit-2
        2 months ago

        public string GetDayOfWeek(DateTime date) => "saturday";

        I also calculated it, his result checks out.

        • @al4s
          link
          42 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"
              };
          }
          
    • @Bgugi
      link
      32 months ago

      Bro probably to account for leap Thursday’s. We have one every ~28k years to keep in alignment with the true solar week.

      • dch82
        link
        fedilink
        12 months ago

        Took me longer than it should have to realise this was a joke.