You are viewing a single thread.
View all comments View context
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

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

  • 3.5K

    Posts

  • 108K

    Comments