# String replace - help please

**URL:** <https://discourse.nodered.org/t/string-replace-help-please/13388>\
**Category:** General\
**Created:** [17 July 2019 11:03 UTC](https://discourse.nodered.org/t/string-replace-help-please/13388 "2019-07-17T11:03:17Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [17 July 2019 13:39 UTC](https://discourse.nodered.org/t/string-replace-help-please/13388/21 "2019-07-17T13:39:02Z")

</div>

Actually [ISO8201 is the standard](https://en.wikipedia.org/wiki/ISO_8601) 😉 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](https://whatis.techtarget.com/definition/Coordinated-Universal-Time-UTC-GMT-CUT) ) or Coordinated Universal Time (but abbreviated UTC), and formerly called Greenwich Mean Time.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 July 2019 16:31 UTC](https://discourse.nodered.org/t/string-replace-help-please/13388/22 "2019-07-17T16:31:02Z")

</div>

> [@Trying\_to\_learn](#):
>
> But when looking at logs because something is going on, looking at logs with dates 10 hours ago, it gets confusing

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.

> [@Trying\_to\_learn](#):
>
> So YYYY/DD/MM HH:mm:ss is way preferred

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).

> [@Trying\_to\_learn](#):
>
> The only nicer thing for it is to make any value \<10 formatted with a leading `0`

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.

> [@bakman2](#):
>
> Date/time is probably the most annoying element about computers.

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.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [17 July 2019 20:14 UTC](https://discourse.nodered.org/t/string-replace-help-please/13388/23 "2019-07-17T20:14:21Z")

</div>

> [@TotallyInformation](#):
>
> 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.

Just for entertainment, check out [nautical time](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/List_of_military_time_zones) used by the military. These are A-Z, except J, and do not reflect DST.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 July 2019 23:02 UTC](https://discourse.nodered.org/t/string-replace-help-please/13388/24 "2019-07-17T23:02:23Z")

</div>

> [@drmibell](#):
>
> Strictly speaking, UTC is not a time zone. It is (not quite exactly) solar time at a particular location (0º longitude).

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

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [17 July 2019 23:07 UTC](https://discourse.nodered.org/t/string-replace-help-please/13388/25 "2019-07-17T23:07:43Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/string-replace-help-please/13388.md?page=1)
