RFC 3339 and ISO 8601 in application logs
Correlate events across UTC offsets, preserve fractional seconds, and define which ISO 8601 representations a log importer can safely accept.
How we checked this guide. We checked the offset examples against ADEMN’s timestamp converter and compared the 185-millisecond interval with the difference between the UTC instants. Editorial and testing standards
Give a log timestamp a precise contract
A log field documented as “ISO 8601” leaves several decisions to whoever builds the importer. A date on an invoice, an elapsed duration and the instant when a job finished can all use representations from the ISO 8601 family. Only one of those fields belongs on an event timeline without further interpretation. Someone reading 2026-03-14 can identify the calendar day. They still need a time and an offset to say when an event occurred.
RFC 3339 defines a narrower Internet timestamp format with a calendar date, a time including seconds, and a UTC designator or numeric offset. Its grammar allows an optional fraction of a second. A logging system can narrow this further. For example, its producer contract could require uppercase T and Z, UTC on output, and three fractional digits. A consumer with that contract can tell the difference between an omitted field and a legitimate change of representation.
| Input | Information present | Decision for a timestamp field |
|---|---|---|
| 2026-03-14 | Calendar date | Keep as a date or ask for an event time |
| 2026-03-14T00:10:05 | Local date and clock time | Resolve the missing offset from a documented source |
| 2026-03-14T00:10:05+05:30 | Date, time and explicit offset | Can be converted to a UTC instant |
Correlate two records on opposite sides of midnight
Consider a fictional job identified as job-42. The publisher writes its local timestamp just after midnight on March 14. A consumer records the same job on March 13. Sorting by the dates as printed would put the consumer first. Use the explicit offsets to normalize both clocks. For a positive offset, subtract the offset to reach UTC. For a negative offset, add its magnitude. In this case both results fall on March 13 at 18:40 UTC.
Open Unix Timestamp Converter and choose Date to Timestamp. Enter each timestamp exactly as shown, including its fractional seconds and offset. The explicit offset makes the result independent of the browser’s local timezone. Subtract the publisher’s integer milliseconds from the consumer’s. The difference is 185 milliseconds. Keep the job identifier alongside the calculation. Two records from unrelated jobs can also fall within that interval, so matching a narrow time range by itself gives weak evidence that the records belong together.
job-42 published 2026-03-14T00:10:05.125+05:30
UTC 2026-03-13T18:40:05.125Z
Unix milliseconds 1773427205125job-42 received 2026-03-13T14:40:05.310-04:00
UTC 2026-03-13T18:40:05.310Z
Unix milliseconds 1773427205310Find the order hidden by millisecond display
A second job emits two events within the same millisecond. Its stored timestamps end in .125400 and .125900. The fractional parts are 125400 and 125900 microseconds into the second. Their difference is 500 microseconds. A system that truncates both values to three decimal places will display .125 for each. It is still possible to show a concise time in the interface if the underlying records retain all six digits for sorting and comparison.
The ADEMN converter accepts up to three fractional digits. Give it an explicitly truncated copy only when a millisecond comparison is what you want. Keep the six-digit strings to reproduce the finer result. For these two inputs, the date, time down to seconds, offset and number of fractional digits are all identical except for the fractional values. You can subtract the microseconds directly. For inputs that span whole seconds, include the whole-second difference before combining the fractional parts.
2026-03-13T18:40:05.125400Z sequence=81
2026-03-13T18:40:05.125900Z sequence=82
125900 − 125400 = 500 microsecondsChoose a sort key that survives exports
Text ordering works for consistently formatted UTC strings when their date and time components use the same widths, the suffix is identical, and their fractional precision is the same. Mixed offsets broke that shortcut in the first example. Mixed widths can break it even in UTC. Compare the two strings below. In an ordinary ascending bytewise sort, the digit 1 in the longer fraction comes before the letter Z in the shorter timestamp. The later instant can therefore appear first.
Convert both to the same precision by padding on the right. The shorter fraction .1 becomes .100, while .101 keeps its three digits. Now both end in Z, sorting matches chronology and the difference is one millisecond. Padding adds no measurement accuracy. If an emitter only records whole seconds, its printed .000 cannot establish where an event fell within that second. Keep a sequence number or another source of ordering when the distinction matters.
2026-03-13T18:40:05.1Z → 2026-03-13T18:40:05.100Z
2026-03-13T18:40:05.101Z → 2026-03-13T18:40:05.101ZKeep event time and collection time in different fields
A collector may receive a group of events after the connection to a producer resumes. If a batch arrives at 18:45 UTC, assigning that arrival time to every row makes five minutes of work appear simultaneous. Preserve the producer’s event timestamp in one field and the collector’s receipt timestamp in another. A report about delivery lag needs both columns. A report about when an operator performed an action usually starts with the event field and its original source.
Use job-42 to check a migration of the log pipeline. Export the two rows, import them into a scratch dataset, and export them again with their identifiers and offsets. The normalized times must still differ by 185 milliseconds. The original strings may differ if the destination intentionally stores UTC, so choose beforehand whether preserving the incoming offset is also part of the contract. Repeat with the two six-digit inputs and inspect the saved fields at full precision. A dashboard can hide digits that the storage engine preserved, and a six-digit display can pad values that the importer already shortened.
Decide what happens when information is missing
An offset describes the difference from UTC at the recorded instant. It does not identify a geographic timezone with rules for future dates. If a job is scheduled to run at nine every morning in a particular city, the scheduler needs the named timezone as part of its instructions. The resulting log entry can still record the actual run as a timestamp with an offset. Retaining the zone name in a separate field helps a later investigation reconstruct the schedule.
Give an importer a visible outcome for values it cannot represent. For a missing offset, preserve the original text and record which producer needs checking. For excessive precision, decide whether to keep a second high-resolution field, reject the record or document a rounding rule. Keep rejected values out of the normal event timeline until resolved. Silently assuming the analyst’s local timezone can make two people investigating the same export produce different event orders.
When measuring a delay across hosts, record which clock produced each field. The 185 milliseconds above is a difference between recorded instants. If the clocks disagree, the result includes that disagreement. Compare a job identifier and a queue sequence, or a duration measured with a single monotonic clock, before attributing the whole interval to processing time. Those additional observations let a reader distinguish a long-running job from an import that changed the timestamps.