@PugJesus@lemmy.world to memes@lemmy.worldEnglish • 4 months agoThe last hopelemmy.worldimagemessage-square33fedilinkarrow-up1831arrow-down15
arrow-up1826arrow-down1imageThe last hopelemmy.world@PugJesus@lemmy.world to memes@lemmy.worldEnglish • 4 months agomessage-square33fedilink
minus-squareEpheralinkfedilink6•4 months agoYep, my immediate thought was, how the hell would you know it works?
minus-square@odium@programming.devlinkfedilink3•4 months agoThat program better be using an existing date library, because otherwise it’s most definitely wrong.
minus-square@asyncrosaurus@programming.devlinkfedilink3•edit-24 months agopublic string GetDayOfWeek(DateTime date) => "saturday"; I also calculated it, his result checks out.
minus-square@al4s@lemmy.worldlinkfedilink4•4 months agoDon’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" }; }
minus-square@Bgugi@lemmy.worldlinkfedilink3•4 months agoBro probably to account for leap Thursday’s. We have one every ~28k years to keep in alignment with the true solar week.
minus-squaredch82linkfedilink1•4 months agoTook me longer than it should have to realise this was a joke.
Yep, my immediate thought was, how the hell would you know it works?
That program better be using an existing date library, because otherwise it’s most definitely wrong.
public string GetDayOfWeek(DateTime date) => "saturday";
I also calculated it, his result checks out.
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" }; }
Bro probably to account for leap Thursday’s. We have one every ~28k years to keep in alignment with the true solar week.
Took me longer than it should have to realise this was a joke.