this post was submitted on 20 Jul 2024
825 points (99.4% liked)

memes

9658 readers
3464 users here now

Community rules

1. Be civilNo trolling, bigotry or other insulting / annoying behaviour

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

3. No recent repostsCheck for reposts when posting a meme, you can only repost after 1 month

4. No botsNo bots without the express approval of the mods or the admins

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

Sister communities

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] mrspaz@lemmy.world 26 points 1 month ago (1 children)

I wrote a program to figure out what day of the week this landed on (assuming it is in fact October 2nd, 151441).

It's a Saturday.

Real downer on the start of the weekend.

[–] superkret@feddit.org 26 points 1 month ago (1 children)
[–] Ephera@lemmy.ml 6 points 1 month ago (2 children)

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

[–] odium@programming.dev 3 points 1 month ago (1 children)

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

[–] asyncrosaurus@programming.dev 3 points 1 month ago* (last edited 1 month ago) (1 children)

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

I also calculated it, his result checks out.

[–] al4s@lemmy.world 4 points 1 month 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@lemmy.world 3 points 1 month ago (1 children)

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

[–] dch82@lemmy.zip 1 points 1 month ago

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