How-to
How to Convert Log Timestamps to Your Local Time
Server logs in UTC and your clock somewhere else? Read Apache, nginx and ISO 8601 log times and convert them to your zone, daylight saving included.
The problem
“Some of my logs are in UTC, some in the server’s time, and I keep doing the arithmetic in my head to line them up with when users say something broke.”
Why log times never match your clock
Most servers, containers and cloud services write logs in UTC, which never changes for daylight saving, so lines from different machines line up and never repeat an hour. People do not live in UTC. A user reports a failure “at 6:45 this morning” in Los Angeles; the log line you need says 13:45.
It gets worse when sources disagree. A web server writes its own local time with an offset; an application writes UTC with a Z; a desktop tool shows your local time; an old service writes local time with no zone at all. Lining them up in your head means remembering the offset of each source on that date: Los Angeles is seven hours behind UTC in summer and eight in winter.
The common log timestamp formats:
| Where | Looks like | Zone |
|---|---|---|
| Apache and nginx access logs | 29/Jun/2024:13:45:07 +0000 | offset written at the end |
| Containers, cloud logging, JSON logs | 2024-06-29T13:45:07.123456789Z | UTC (the Z) |
| Application logs with an offset | 2024-06-29T15:45:07+02:00 | offset written |
| Event pipelines and metrics | 1719668707123 | UTC (Unix milliseconds) |
| Plain local logs | 2024-06-29 13:45:07 | not written: ask where it ran |
Fix it on Date And Time Converter
- Copy the timestamp from the log line, only the timestamp, and paste it into the converter. It recognises the Apache/nginx form, ISO 8601 with fractions down to nanoseconds, offsets, and Unix seconds or milliseconds.
- Choose your zone as the target and a readable format such as
YYYY-MM-DD HH:mm:ss. The offset is taken from the zone’s rules for that date, so a log line from last winter converts with the winter offset. - For a timestamp with no zone written, set the source zone to the zone the machine was running in. Without it the converter reads the value as UTC and says so.
- To convert several timestamps at once, paste them into the converter’s value field, one per line and all in the same format: the list opens as a one-column file in the file workspace, where the whole list is read with one setting.
- Input
29/Jun/2024:13:45:07 +0000read as DD/MMM/YYYY:HH:mm:ss ±hhmm (detected)- Result
2024-06-29 06:45:07YYYY-MM-DD HH:mm:ss · YYYY-MM-DD HH:mm:ss · -07:00
Open in the converter: 29/Jun/2024:13:45:07 +0000 → 2024-06-29 06:45:07
- Input
2024-06-29T13:45:07.123456789Zread as YYYY-MM-DDTHH:mm:ss.SSSZ (detected)- Result
2024-06-29 08:45:07YYYY-MM-DD HH:mm:ss · YYYY-MM-DD HH:mm:ss · -05:00
Open in the converter: 2024-06-29T13:45:07.123456789Z → 2024-06-29 08:45:07
On the command line
# GNU date (Linux): a UTC timestamp in Chicago time
TZ=America/Chicago date -d '2024-06-29T13:45:07Z' '+%F %T %Z'
# A Unix timestamp: GNU date, then macOS/BSD date
date -d @1719668707
date -r 1719668707
# systemd journal: show times in UTC instead of local
journalctl --utc Better still for a team, log in UTC with the Z or the offset written, and convert only when reading. Logs that write local time without an offset cannot be put in order across the hour when clocks go back.
Pitfalls
- The offset of today, not of that day. Adding “−7 hours” to every line is wrong for any line written in winter. Use the zone, not a number.
- Nanoseconds. Container logs carry nine decimals. The converter keeps the time to the millisecond; the digits after that are dropped, which is enough to match a line by eye, not to sort lines that share a millisecond.
- Lines, not timestamps. This site reads timestamps, not free text. Paste the timestamp itself; a whole log line is not read.
- The hour that repeats. When clocks go back, local times between 1:00 and 1:59 happen twice. A UTC log has no such hour; converted to local time, two different lines can show the same clock time.
Questions
Why are server logs in UTC?
UTC has no daylight-saving changes, so log lines stay in order and servers in different places agree. The cost is that people reading them have to convert.
What does +0000 at the end mean?
It is the offset from UTC, as hours and minutes. +0000 is UTC itself; -0700 means the time was written seven hours behind UTC.
Can I paste a whole log file?
No: this site reads timestamps, not lines of free text. Copy the timestamp, or paste a list of timestamps in one format, one per line, to convert them together.