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

What’s the correct way to convert Dates.unix2datetime(mtime(fpath)) to a datetime with the correct time zone for my system? I get a time 5 hours in the future, so I assume it’s returning UTC.

julia> Dates.unix2datetime(mtime(fpath))

julia> Dates.now()

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

1 Like

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))
julia> Base.Libc.strftime("%FT%R%z", mtime(fpath))