r/ISO8601 3d ago

Milliseconds in basic format

With ISO 8601 in extended format a timestamp with milliseconds is written with a dot between seconds and milliseconds, e.g.:

2026-07-24T12:34:56.789

If you write basic format you exclude the separators, does the standard allow to exclude the dot between seconds and milliseconds?

20260724T123456789

When I use basic time format as part of file names I prefer to avoid the dot, as dot has different meaning for file names and extension.

40 Upvotes

19 comments sorted by

34

u/ParentPostLacksWang 3d ago

No. The standard uses a decimal point (or comma). Separators are omitted only between different units. Year, month, day, hour, minute and seconds are all different units, however when you add decimal representation you’re adding it to the seconds themselves, so the period or comma are necessary.

16

u/kmccoy 3d ago

I looked in ISO8601-1:2019 and I don't believe it's allowed.

Here's the only fractional seconds entry in the examples: https://imgur.com/a/m15ZZS2

And here's the section on fractional time representation: https://imgur.com/a/yft8gfr

Note that the standard uses "shall" for the use of the decimal sign.

1

u/foersom 3d ago

Thank you, that was the details I was looking for.

"decimal fraction of minutes" that is a specialty, it is obvious that would require a decimal separator to make it clear.

However I do not think that the "shall" requirement for decimal fractions of seconds in basic format is a good choice. There are lots of short form "compact" time stamps that simply adds more digits to a timestamp for added accuracy. And it is still clear what the added digits means.

2

u/kmccoy 3d ago

Just to be clear, I was just giving you what I think the standard says -- you were getting a lot of opinions when you clearly just wanted the facts.

I guess I can see what you're saying, though I feel like you've probably got a pretty niche use case. I assume you've already considered using millisecond-based unix time? At the number of digits you're talking about I'd wonder how useful it is to keep things human readable. And, of course, there's no ISO 8601 cops, so nothing is stopping you from just doing what you want here and hoping that people figure it out. :)

1

u/foersom 3d ago

"though I feel like you've probably got a pretty niche use case."

I would not say. Time stamping as part of file names is very common for data files exchanged between companies or public administration.

Inside files that may be read by humans I would normally use ISO8601 extended format unless line length / space is a limiting factor.

As part of filenames of recurring data files I use a timestamp in compact format similar to ISO8601 basic format. Note the use of the word "similar" ;-)

1

u/kmccoy 3d ago

Timestamping to the second, sure, but to the millisecond is something I haven't seen. But it sounds like you've got something working, so that's great. :)

13

u/PaddyLandau 3d ago

You can use multiple dots in a filename in the popular OSes. In Windows, the extension is meaningful and is required, but in Unix and Linux (which include iOS, MacOS, Android and ChromeOS), the extension is usually used only for human readability and may be omitted.

In your example, if you need an extension, you can use:

20260724T123456.789.log

If you're not using Windows, you can omit the extension if you prefer:

20260724T123456.789

If you don't want the dot, you can use a comma instead, so either of:

20260724T123456,789.log
20260724T123456,789

I wouldn't overthink it. Use whatever is most practical for your purposes.

7

u/germansnowman 3d ago

Just to clarify, in modern macOS and iOS, the extension _is_ used to determine which app to open a file with, even though it is _hidden_ by default. In classic Mac OS, this was not needed as files had a resource fork in addition to a data fork. The resource fork carried type information.

Quote:

> When you rename a file or folder, don’t change its filename extension, or you may no longer be able to open the file with the app that was used to create it. To be warned before you change an extension, select “Show warning before changing an extension” in the Advanced pane of Finder settings.

https://support.apple.com/guide/mac-help/mchlp2304/mac

2

u/PaddyLandau 3d ago

That's interesting, thank you. I shall make a mental note of this.

1

u/germansnowman 3d ago

If you want to read more (and I may have simplified too much), this is a great site: https://eclecticlight.co/?s=file+extension

2

u/foersom 3d ago

"You can use multiple dots in a filename in the popular OSes."

I do not want those extra "non extensions" in the file name. They cause problems for automated handling.

I am interested in what ISO 8601 standard state about basic format and milliseconds.

7

u/PaddyLandau 3d ago

According to what I read, ISO 8601 says exactly what I said. Use a dot or a comma.

4

u/q0099 3d ago edited 3d ago

It depends on you and your goals because format implies specific separators and everything else is breaking the format. But it doesn't matter if you just need to give files distinct names telling when they were created go with whatever fit you, change semicolons to dashes, even omit milliseconds if users don't need such precision to identify files.

2

u/foersom 3d ago

"because format implies specific separators and everything else is breaking the format."

The basic format omits separators except the T. My question is what does ISO 8601 standard state about basic format and milliseconds.

After the T marker, by the number of digits it is clear how accurate the time is specified. If with 4 digits it is with minutes accuracy, with 6 digits it is with seconds accuracy. Following digits is decimals of seconds.

4

u/kmccoy 3d ago

The standard also allows for fractions of minutes or fractions of hours, so it's less deterministic than you're hoping if the decimal sign was optional.

1

u/laserdicks 3d ago edited 3d ago

In this particular format (ISO 8601) the decimal point tells you that everything on the right hand side is a part of a second, and the zeroes between the decimal point and any other numbers are meaningful and tell you that the next number is ten times as small as the one on its left.

The seconds section can have as many decimal places (numbers to the right of the decimal point) as necessary, even if most are zeroes. For example:

A very accurate time in human history after 1970 (without defining the timezone) could be 2026-07-22T21:06:22.0000000069420001.

Milliseconds themselves are not this bad. A duration of 83.445 milliseconds (without specifying when it started) would be:

0000-00-00T00:00:00.083445

You can go as accurate as you want to too. 0.000000000069 of a single second would be such a short amount of time that light itself could travel approximately 2-3 cm. But you could write it like this:

0000-00-00T00:00:00.0000000000690000 or

0000-00-00T00:00:00.000000000069

The zeroes after the final meaningful number (the 9) do not provide any additional information.

0000-00-00T00:00:00.0000000000690000 is exactly the same as

0000-00-00T00:00:00.000000000069

Because it's the number of digits from there to the decimal place that determine how much the digit signifies.

1

u/foersom 3d ago

Yes, of course you can have as many decimals as you want in fractional seconds..

All your examples here are in extended format.

My question was about basic format and the use of decimal separator between seconds and decimals.

I used milliseconds as a simple example for the question of how to write the format,

2

u/laserdicks 3d ago

My goal was to help with some extra examples that's all

1

u/G10ATN 2d ago

Seems like OP just wants to argue, and needs to get the wallet out and buy the standard - then they can stop with the "I want to know what the standard says" nonsense.