You are viewing a single thread.
View all comments View context
6 points

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

permalink
report
parent
reply
3 points

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

permalink
report
parent
reply
3 points
*

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

I also calculated it, his result checks out.

permalink
report
parent
reply
4 points

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"
    };
}
permalink
report
parent
reply
3 points

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

permalink
report
parent
reply
1 point

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

permalink
report
parent
reply

memes

!memes@lemmy.world

Create post

Community rules

1. Be civil

No trolling, bigotry or other insulting / annoying behaviour

2. No politics

This is non-politics community. For political memes please go to !politicalmemes@lemmy.world

3. No recent reposts

Check for reposts when posting a meme, you can only repost after 1 month

4. No bots

No bots without the express approval of the mods or the admins

5. No Spam/Ads

No advertisements or spam. This is an instance rule and the only way to live.

Sister communities

Community stats

  • 13K

    Monthly active users

  • 2.3K

    Posts

  • 48K

    Comments