this post was submitted on 02 Sep 2024
220 points (98.2% liked)

Programming

17417 readers
38 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

There are a couple I have in mind. Like many techies, I am a huge fan of RSS for content distribution and XMPP for federated communication.

The really niche one I like is S-expressions as a data format and configuration in place of json, yaml, toml, etc.

I am a big fan of Plaintext formats, although I wish markdown had a few more features like tables.

you are viewing a single comment's thread
view the rest of the comments
[–] mox@lemmy.sdf.org 129 points 2 months ago* (last edited 2 months ago) (9 children)

ISO 8601 date format. Not because it's from a standards body, but because it's simple, sensible, clearly defined, easy to recognize, and very effective.

Date field placement in any order other than most-significant-digits-first is not only counterintuitive, but needlessly complicated to work with. Omitting critical information like the century is ambiguous and confusing.

We don't live in isolated villages any more. Mixing and matching those problems by accepting all the world's various regional and personal date styles, especially with no reliable indication of which ones apply in any given case, leads to the hodgepodge of error-prone date madness that we have today.

The 2024-09-02 format should be taught in schools and required in official documents. Let the antiquated date styles fall into disuse outside of art and personal correspondence, like cursive writing.

[–] MoonlightFox@lemmy.world 40 points 2 months ago

And it can be sorted alphabetically in all software. That's a pretty big advantage when handling files on a computer

[–] driving_crooner@lemmy.eco.br 17 points 2 months ago

I had the fortune of being hired to build up from zero my department, and one of the first "rules" I made was all dates are ISO-8601 and now every process runs with 8601, if you use anything different your code is going to fail eventually when it finds another column date in 8601.

[–] pHr34kY@lemmy.world 17 points 2 months ago* (last edited 2 months ago) (1 children)

I love this standard. If you dig deeper into it, the standard also covers a way to express intervals and periods. E.g. "P1Y2M10DT2H30M" represents one year, 2 months, 10 days, 2 hours and 30 mins.

I recall once using the standard when writing a cron-style scheduler.

I also like the POSIX "seconds since 1970" standard, but I feel that should only be used in RAM when performing operations (time differences in timers etc.). It irks me when it's used for serialising to text/JSON/XML/CSV.

Also: Does Excel recognise a full ISO8601 timestamp yet?

[–] jim@programming.dev 3 points 2 months ago (1 children)

I also like the POSIX “seconds since 1970” standard, but I feel that should only be used in RAM when performing operations (time differences in timers etc.). It irks me when it’s used for serialising to text/JSON/XML/CSV.

I've seen bugs where programmers tried to represent date in epoch time in seconds or milliseconds in json. So something like "pay date" would be presented by a timestamp, and would get off-by-one errors because whatever time library the programmer was using would do time zone conversions on a timestamp then truncate the date portion.

If the programmer used ISO 8601 style formatting, I don't think they would have included the timepart and the bug could have been avoided.

Use dates when you need dates and timestamps when you need timestamps!

[–] cout970@programming.dev 7 points 2 months ago

Thats an issue with the time library, not with timestamps. Actually timestamps are always in UTC, you need to do the conversion to your local time when displaying the value. There should be no possible off-by-one errors, unless you are doing something really wrong.

[–] The_Decryptor@aussie.zone 14 points 2 months ago* (last edited 2 months ago) (1 children)

RFC 3339 is a simplified profile of 8601 that only covers YYYY-MM-DD style formatting, if you only ever use that format and avoid the things like "2024-W36" they're mostly interchangeable.

[–] sxan@midwest.social 1 points 2 months ago

The week-of-year is far more relevant in Western Europe, and is used quite a bit in business. I have a Junghans watch that has a week complication.

It's an important format outside of the US, and gives ISO-8601 an edge as a standard of conformance.

[–] NostraDavid@programming.dev 4 points 2 months ago (2 children)
[–] mox@lemmy.sdf.org 1 points 2 months ago (1 children)

That looks like an interesting diagram, but the text in it renders too small to read easily on the screen I'm using, and trying to open it leads to a javascript complaint and a redirect that activates before I can click to allow javascript. If it's yours, you might want to look in to that.

The table below works, though. Thanks for the link.

[–] NostraDavid@programming.dev 1 points 2 months ago

Alas it's not my site (and I think it's meant to be read on a desktop screen), so I can't fix it.

[–] ulterno@lemmy.kde.social 0 points 2 months ago

7 digit years feels way to optimistic, but I'll be rooting for us.

[–] caturra@lemmynsfw.com 2 points 2 months ago

I arrived to manage releases in a company, the previous manager named releases as "release04092016", as USA standard. My first recommendation was to name releases as "releaseyyyymmdd" so "release20160409". I was asked by another manager why to change that, so I showed her a sorted list of releases "git branches" and asked her, can you tell me there when was the last release? (a very common question) Of course, to find the last release you need to check the whole list because the mmddyyyy order is useless. The answer with yyyymmdd was immediate, just look at the last row.

[–] Remavas@programming.dev 1 points 2 months ago

Some countries already use it officially too :)

[–] ulterno@lemmy.kde.social 0 points 2 months ago

Also, you can sort by ascending file names

[–] DarkMetatron@feddit.org -4 points 2 months ago (2 children)

The year is the information that most of the time is the least significant in a date, in day to day use.

DDMMYY is perfect for daily usage.

[–] suigenerix@lemmy.world 9 points 2 months ago (1 children)

DDMMYY is perfect for daily usage.

Except that DDMMYY has the huge ambiguity issue of people potentially interpreting it as MMDDYY. And it's not straight sortable.

My team switched to using YYYY-MM-DD in all our inner communication and documents. The "daily date use" is not the issue you think it is.

[–] GamingChairModel@lemmy.world 5 points 2 months ago (1 children)

Your day to day use isn't everyone else's. We use times for a lot more than "I wonder what day it is today." When it comes to recording events, or planning future events, pretty much everyone needs to include the year. Getting things wrong by a single digit is presented exactly in order of significance in YYYY-MM-DD.

And no matter what, the first digit of a two-digit day or two-digit month is still more significant in a mathematical sense, even if you think that you're more likely to need the day or the month. The 15th of May is only one digit off of the 5th of May, but that first digit in a DD/MM format is more significant in a mathematical sense and less likely to change on a day to day basis.

[–] DarkMetatron@feddit.org -1 points 2 months ago (1 children)

For any scheduled date it is irrelevant if you miss it for a day, a month or a year. So from that perspective every part of it is exactly the same, if the date is wrong then it is wrong. You say that it is sorted in the order of most significants, so for a date it is more significant if it happend 1024, 2024 or 9024? That may be relevant for historical or scientific purposes but not much people need that kind of precision. Most people use calendars for stuff days or month ahead or below, not years or decades.

If I get my tax bill, I don't care for the year in the date because I know that the government wants the money this year not next or on ten. If I have a job interview, I don't care for the year, the day and months is what is relevant. It has a reason why the year is often removed completely when dates are noted or made. Because it Is obvious.

Yes I can see why YYYY-MM-DD is nice for stuff like archiving purposes, it makes sorting and grouping very easy but there they already use the best system for the job.

For digital documents I would say that date and time information should be stored in a defined computer readable standard so that the document viewer can render or use it in any way needed. That could be swatch internet time as far as I care because hopefully I would never look at the raw data at all.

[–] GamingChairModel@lemmy.world 3 points 2 months ago (1 children)

You say that it is sorted in the order of most significants, so for a date it is more significant if it happend 1024, 2024 or 9024?

Most significant to least significant digit has a strict mathematical definition, that you don't seem to be following, and applies to all numbers, not just numerical representations of dates.

And most importantly, the YYYY-MM-DD format is extensible into hh:mm:as too, within the same schema, out to the level of precision appropriate for the context. I can identify a specific year when the month doesn't matter, a specific month when the day doesn't matter, a specific day when the hour doesn't matter, and on down to minutes, seconds, and decimal portions of seconds to whatever precision I'd like.

[–] DarkMetatron@feddit.org 0 points 2 months ago

Ok, then I am sure we will all be using that very soon, because abstract mathematic definitions always map perfectly onto real world usage and needs.

It is not that I don't follow the mathematic definition of significance, it is just invalid for the view and scope of the argument that I make.

YYYY-MM-DD is great for official documents but not for common use. People will always trade precision for ease of use, and that will never change. And in most cases the year is not relevant at all so people will omit it. Other big issue: People tend to write like they talk and (as far as I know) nobody says the year first. That's exactly why we have DD-MM and MM-DD

YYYY-MM-DD will only work in enforced environments like official documents or workspaces, because everywhere else people will use shortcuts. And even the best mathematic definition of the world will not change that.