Mixpanel Community Icon

Custom Properties for Time and Date Casting in Formulas

·
·

Is there a formula or function for use in custom properties to cast the result as a time or date?

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Hi Andrew S., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹

    Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Yes, Mixpanel supports the use of formulas and functions in custom properties to work with date and time data. However, there isn't a specific function to cast a result as a date or time. Instead, you can use the datedif function to subtract two dates. The syntax for this function is datedif(start_date,end_date,unit). For example, datedif(registrationdate,TODAY(), "M") would calculate the number of months since a user's registration date.If you have a property that is a unix timestamp and got sent as a number, you can typecast it to a Date data type in Mixpanel reports. An ISO formatted date YYYY-MM-DDTHH:MM:SS in UTC is used for the Date data type. Note that all timestamps need to be sent in UTC timezone in an ISO format.For more details, you can refer to the Mixpanel documentation on custom properties and data types.

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ⤵️ Hint: Mention @kapa.ai in the thread for follow-ups.