Timestamp Parser

Last updated:

|Edit this page

This transformation parses the timestamp of each event that comes in to PostHog and adds the following time-based properties:

PropertyDescriptionExample
day_of_the_weekPlain text value for the day of the weekMonday
dayNumeric value for the day within a month7
monthNumeric value corresponding to the current month6 (June)
yearNumeric value of the year2022
hourNumeric value for the hour in UTC (24-hour clock)21
minuteNumeric value for the minute37

Requirements

Using this requires either PostHog Cloud with the data pipelines add-on, or a self-hosted PostHog instance running a recent version of the Docker image.

Installation

  1. In PostHog, click the "Data pipeline" tab in the left sidebar.
  2. Click the 'Transformations tab'.
  3. Click the '+ New Transformation' button.
  4. Look for the 'Timestamp Parser' and click the '+ Create' button.
  5. Click on the toggle to enable the transformation and then click 'Create'.

Any new events that come in to PostHog will now be automatically parsed!

Using the Timestamp Parser

The timestamp parser is a great tool for answering time-based questions that are sometimes very challenging to tackle with PostHog alone.

By filtering and breaking down events, we can now easily answer questions such as:

  • Do we get more purchases on weekdays or weekends?
  • Why does our traffic spike on Tuesdays?
  • How do users use our platform differently during the holiday season?
  • How does retention compare for users who join on a weekend versus a weekday?

Note: This transformation only works on new events sent to PostHog, and as a result you won't be able to filter events that were sent before it was enabled.

Examples

Here is an example of what these properties look like after they have been added to an event.

event with timestamp properties added

Here's an example of creating a filter in a trends insight to only show events that were send on a Saturday or Sunday.

filter for only events on Saturday or Sunday

We can also break down an insight by month to get an idea of how it varies over the course of a year.

breaking down an insight by month

Overall, the timestamp parser is a simple yet incredibly powerful transformation that these examples only scratch the surface on.

FAQ

Who created this transformation?

We'd like to thank PostHog team member Yakko Majuri and community member Victor Campuzano for creating the Timestamp Parser. Thank you, both!

Who maintains this?

This is maintained by the community. If you have issues with it not functioning as intended, please let us know!

What if I have feedback on this destination?

We love feature requests and feedback. Please tell us what you think.

What if my question isn't answered above?

We love answering questions. Ask us anything via our community forum.

Questions?

Was this page useful?

Next article

URL Normalizer

This transformation normalizes the format of URLs so you can more easily compare them in insights. By default, the URL Normalizer converts all URLs to lowercase and strips trailing /s, overriding the old current_url property. Installation In PostHog, click the " Data pipeline " tab in the left sidebar. Search for 'URL Normalizer' and select the transformation, press Install. Configuration No configuration is needed. The URL Normalizer will automatically convert all URLs to lowercase and remove…

Read next article