221
DateTime (xkcd.com)
submitted 11 months ago by yogthos@lemmy.ml to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] neuracnu@lemmy.blahaj.zone 3 points 11 months ago

.net has a timespan data type specifically for this sort of thing.

[-] BehindTheBarrier@programming.dev 3 points 11 months ago

After using it, coming to python and not having a super easy way to work with dates is a pain.

But DateTime in dotNet have horrible timezone support. It's essentially either local timezone, not timezone or utc. And the utc part is somewhat rough. There's some datetimeoffset and the like, but they too just don't let working with timezones be easy.

[-] CanadaPlus@futurology.today 1 points 11 months ago* (last edited 11 months ago)

I'm guessing it's not alone. Every time format should come with a distance function and order function, or equivalent. If you have a life, that could mean something like subtraction.

Unfortunately, "should" isn't always enough. Optimally there's also type structure to the return of the function so you can't mix up seconds and days, or calendar and (one of the) standard length days.

this post was submitted on 14 Dec 2023
221 points (96.2% liked)

Programmer Humor

32611 readers
46 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS