String replace - help please

Actually ISO8201 is the standard :wink: Zulu is only the time and refers to UTC time. Date/time is probably the most annoying element about computers.

If you want to get confused:

Zulu (short for "Zulu time") is used in the military and in navigation generally as a term for Universal Coordinated Time (UCT), sometimes called Universal Time Coordinated ( UTC ) or Coordinated Universal Time (but abbreviated UTC), and formerly called Greenwich Mean Time.

Well just be aware that it gets far more confusing when a log rolls over a DST change and the timestamps no longer work correctly! It gets even more confusing still if you have to deal with servers in different timezones (or you take a Pi with you across timezones). Or if you forget and have 1 service logging in local time and another logging in UTC or where you need to check logs between local and cloud services, ...

Filenames that are for users, I agree, you probably want those in a timeframe that makes sense to the person. Otherwise, best to learn to use UTC or you will eventually get caught out for the same reasons.

For the same reason as you don't really want ":" in your filenames, you should also avoid "/" since that is typically used as a folder separator. That is one of the reasons that ISO uses dashes. In fact, UNIX type filing systems can use colons in file names (you cannot do that under Windows).

Yes, that makes things a little more complex. You should learn how to do it though because, certainly for filenames, you will want them so that you can sort things correctly.

To be fair, it is the fact that dates and times are so flippin' complicated that is the issue, it isn't the computers fault.

I've been writing date/time utilities since mainframe times and there are more edge-cases than you can even imagine! That's why I generally recommend using libraries to help when doing date/time calculations.

4 Likes

Just for entertainment, check out nautical time.
Fun facts:
Until 1805, the Royal Navy used a nautical day that started at noon. The US Navy gave up the practice in 1848, but it continued elsewhere for about 40 years.
Ships clocks and logs can be kept in basically any time zone the captain chooses, as long as they are referenced to UTC.
Strictly speaking, UTC is not a time zone. It is (not quite exactly) solar time at a particular location (0º longitude).
"Z" (Zulu) is only one of the time zone designators used by the military. These are A-Z, except J, and do not reflect DST.

1 Like

And it is great fun to stand astride the official 0º longitude line in Greenwich in London at the original Royal Observatory. :smile:

1 Like

And to see the chronometers that told the fleet where it was.:wink: