News for hackers. Stuff that matters.
Re:Please put units in names by stevesimmons on Monday March 21, 2022 @02:44AM (#30750989)
How does the C# DateTime type distinguish between dates and a point in time whose time just happens to be midnight?

Much of the C# code I've seen uses names like start_date with no indication of whether it really is a date (with no timezone), a date (in one particular timezone), or a datetime where the time is significant.

I'm certainly not a C# developer, though my quick reading of the docs suggests that the DateOnly type was only introduced recently in .NET6.

Re:Please put units in names by Sharparam on Monday March 21, 2022 @09:23AM (#30753826)
Yeah, before the new DateOnly (and TimeOnly) types, there was no built-in way in C# to specify a plain date. NodaTime[1] (a popular third-party library for datetime operations) did have such types though.

[1]: https://nodatime.org/