What’s the correct way to convert `Dates.unix2datetime(mtime(fpath))` to a datetim

Posting the answer from the slack discussion.

For this particular case, there was a requirement to only use functions in Base (which doesn’t include the Dates stdlib, or the TimeZones package)

Using functions only in Base:

julia> Base.Libc.strftime("%FT%R%Z", mtime(fpath))
"2021-02-01T01:15CET"
julia> Base.Libc.strftime("%FT%R%z", mtime(fpath))
"2021-02-01T01:15+0100"
2 Likes