Nanoseconds to date converter
Converts a nineteen-digit nanosecond timestamp into a date. Go’s `time.UnixNano()`, Prometheus and most tracing systems work in nanoseconds.
How to use the nanoseconds to date converter
Nanosecond precision runs into a hard limit that catches people out: a signed 64-bit integer of nanoseconds only spans about 584 years, so Go’s UnixNano is documented as undefined outside 1678 to 2262. That is fine for observability data and wrong for anything historical. The other practical point is that JavaScript cannot represent these numbers exactly: a nineteen-digit integer exceeds the 53-bit safe integer range, so parsing one into a Number loses the last few digits. Anything comparing nanosecond timestamps for ordering needs BigInt or strings, not floats.
Questions
Go’s time package, Prometheus, OpenTelemetry and most distributed tracing.
Signed 64-bit nanoseconds only spans about 584 years — roughly 1678 to 2262.
Not as a Number. That exceeds the safe integer range, so the last digits are lost. Use BigInt or keep it as a string.
No, everything here is UTC. Timestamps are stored in UTC precisely so they are unambiguous; converting to a local zone is a separate step and needs to know the zone.
The unit is; the accuracy usually is not. Most clocks are accurate to microseconds at best, so the last three digits are noise.