Question

Is there any way to remove times from dates?

  • 4 August 2020
  • 1 reply
  • 263 views

I pass in date as “8 June 2020” with people.set method, but mixpanel automatically changes it to “10:00 pm 7 June 2020”, is therey any way to make mixpanel ignore times and just display “8 June 2020” ? I have to display this date in custom mixpanel messages, but without the time.


1 reply

Userlevel 6
Badge +3

@hmmman — 

Are you sending this date as a date data type

To guarantee appropriate typecasting across all Mixpanel reports, use the date format YYYY-MM-DDTHH:MM:SS. Make sure you’re sending dates in this format by using the .toISOString method in JavaScript if possible, which will also ensure dates are sent to Mixpanel in UTC.

If you send a unix timestamp as a date, Mixpanel will treat it as an integer; however, in the Mixpanel UI, you can force it to be treated as a date (see Typecasting section below).

Note: A property value that is formatted as a date will be passed as a date type.

Example:

mixpanel.track('Account Created',{'Date First Seen':'2016-06-01T12:34:56'});

 

If you need a specific format for your email that is not compatible here, you could test using a different data type to see if it better fits your needs — ie, could you test sending an additional truncated property with the same value as a string?

Reply


Mixpanel