Community Tip: All About Time - Mixpanel
Blog Post

Community Tip: All About Time

In this Community Tip we discuss all aspects of time in Mixpanel, including how to set your project timezone, send time properties, and handle timestamps when exporting or importing data. Using these directions, Mixpanel can help standardize how you handle time to ensure your data reflects accurate timestamps.

In today’s connected world, a startup can be headquartered in Berlin, Germany, have a core user-base in Beijing, China, and be analyzing their data through an analytics company in San Francisco, California, USA. With all of these different locations in play, seamlessly handling time data being received from around the world can be intimidating. Luckily, with a few of the following best practices, you can ensure your Mixpanel data is time agnostic to the physical location of your users.

Setting Your Mixpanel Timezone

When you create a new Mixpanel project, your project timezone will default to US/Pacific. If you’d like to change your timezone, access the settings gear icon in the bottom left-hand corner of your project and you will be able to change the timezone under the “Management” tab.

Timezone Settings

It is important to note that only the project owner will have access to change the project timezone – other project members will only be able to view which timezone a project has set.

How do Timezones affect Data?

Once you have your timezone set correctly, any dates or times should be sent to Mixpanel in Coordinated Universal Time (UTC). By default, Mixpanel’s integration libraries work with our API ingestion endpoints to timestamp events for you in UTC. Should you overwrite the default timestamp, import old data, or set a property that is in date format (e.g. Account Created Date), you will want to be sure to send the timestamp or date in UTC.

Upon receiving the timestamp or date in UTC time, Mixpanel will automatically convert the time to your project timezone before storing your data. This project timezone date or timestamp will be hardcoded in our backend and cannot be altered later.

Best Practice for Changing Timezone

Any Mixpanel data that exists in your project will be hardcoded in our datastore with a timestamp in the timezone your project has set. Should you need to change your timezone, a change will only update new data – past data which was stored in a different timezone will not be changed when the timezone is modified on a project.

As such, a changed timezone can result in either going ‘backwards’ or ‘forwards’ in time, creating a temporary doubling effect on your data, or an ominous looking hole in time where no data is received. This is due to the fact that the existing data remains in the previous timezone, but the new data either jumps forward in time or goes back to an earlier timezone.

If a change is needed, utilize Mixpanel annotations to clearly demarcate when the change occurred – this will help you and any team members utilizing your Mixpanel data remember exactly what setting was changed and when.

Sending Date Properties to Mixpanel

Earlier, we discussed that you should send date properties to Mixpanel converted to UTC time. Date properties are one of the 5 data types Mixpanel accepts. For this type of property, we recommend an isoformatted date string (YYYY-MM-DDTHH:mm:ss) in order to properly utilize this within your Mixpanel reports.

Below are some code examples from our client-side libraries which allow you to send a property to Mixpanel with a correctly formatted UTC timestamp.

Javascript: new Date().toISOString()

mixpanel.track("Sign Up", {"Account Created Date": new Date().toISOString()});

iOS: [NSDate date]

NSDate *today = [NSDate date];
[mixpanel.people set:@{@"Account Created Date": @today}];

Android: dateFormat.format(new Date())

final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
JSONObject props = new JSONObject();
try {
props.put("time-example", dateFormat.format(new Date()));
} catch (Exception e) {

mMixpanel.track("Account Created Date", props);

Exporting Data from Mixpanel

When you’re exporting raw data from Mixpanel, your request requires the date parameters ‘from_date’ and ‘to_date’, which determine what date range of data to return. The ‘from_date’ and ‘to_date’ values are interpreted by our raw export machines in relation to your project’s timezone, meaning if you request a single day’s worth of data you are receiving one full day in your project’s timezone, not one full day in UTC.

As mentioned earlier, timestamps on your events are hardcoded in your project’s timezone. The ‘$time’ property thus returned from a raw export is a unix timestamp representing the number of seconds that have elapsed since 00:00:00 on January 1, 1970 in your project’s timezone, not UTC.

In the below example, if your project’s timezone is US/Pacific, the below parameters will return 00:00:00 Aug. 1 to 11:59:59 Aug. 1 PDT, or 07:00:00 Aug. 1 – 06:59:59 Aug. 2 UTC.

from_date = "2015-08-01"
to_date = "2015-08-01"

Importing Data into Mixpanel

Imported data to Mixpanel should always be sent in UTC – timestamps on events and any date properties will need to be sent to Mixpanel in UTC in order to correctly display in your project.

If you’re working with exported Mixpanel data, the timestamps on events, and any date properties on events and people, will have been hardcoded into your project’s timezone. This means that, on an extract, transform, and load operation, a quick timestamp and date property offset is needed to ‘reset’ your data back to UTC before importing it back into Mixpanel.

Struggling with timestamps in your project or simply have questions related to time? Reach out to to speak to someone smart, quickly.

Get the latest from Mixpanel
This field is required.