@[email protected] to [email protected]English • 2 months agoThe last hopelemmy.worldimagemessage-square33fedilinkarrow-up1830arrow-down15
arrow-up1825arrow-down1imageThe last hopelemmy.world@[email protected] to [email protected]English • 2 months agomessage-square33fedilink
minus-square@asyncrosauruslink3•edit-22 months agopublic string GetDayOfWeek(DateTime date) => "saturday"; I also calculated it, his result checks out.
minus-square@[email protected]linkfedilink4•2 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" }; }
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" }; }