Timestamps
Contents
PostHog automatically computes timestamps for captured events, but you can also set them manually. On legacy capture:
If the payload contains
timestampandsent_atfields, thesent_atfield is compared to the server time to account for clock skew. The event'stimestampis adjusted by this difference before being stored. This is the method SDKs on legacy capture use.If the payload includes a
timestampbut nosent_atfield, thentimestampis directly used as the event timestamp.If the payload contains
timestamp,sent_at, and$ignore_sent_atfields, thentimestampis used directly as the event timestamp. Using$ignore_sent_atcould be useful during historical data imports.If
offsetis included in the payload, then this value is interpreted as milliseconds and is subtracted from the capture time recorded by the server to obtain the event timestamp. The first two alternatives have higher priority sooffsetis ignored iftimestampis present.Finally, as a fallback when no
timestamporoffsetare included in the payload, the capture time recorded by the server is used as the event timestamp.
Capture v1
Capture v1 works the same way, with different fields:
- Every event must have a
timestamp, in RFC 3339 format with at least millisecond precision. - The
PostHog-Request-Timestampheader replacessent_at. PostHog compares it with the time it received the request and adjusts each event'stimestampby the difference. - The
disable_skew_correctionevent option replaces$ignore_sent_at. It keeps yourtimestampas sent. A timestamp more than 23 hours in the future is still replaced with the time PostHog received it. offsetisn't used.
Timestamp format
On legacy capture, timestamp and sent_at fields should be in ISO 8601 format like 2023-12-13T15:45:30.123Z or YYYY-MM-DDTHH:MM:SSZ. Capture v1 needs RFC 3339 format, as described above.
Note:
posthog-jsalso sends$timeproperty, but this isn't used anywhere in the ingestion pipeline.
Here's a flowchart for how legacy capture computes the event timestamp:
Recognized formats
Although we recommend using the ISO 8601 format, PostHog can also detect several other formats of string as dates and times:
- YYYY-MM-DD,
- YYYY-MM-DD HH:mm:SS,
- DD-MM-YYYY HH:mm:SS,
- DD/MM/YYYY HH:mm:SS,
- YYYY/MM/DD HH:mm:SS
- the RFC 822 standard
In detection, day and month are interchangeable so MM-DD-YYYY would be detected as a date.
Ten and thirteen digit numbers are detected as timestamps if the property name includes "time" or "timestamp."





