MENU
    Using Datetime Expressions
    • 21 Sep 2023
    • 1 Minute to read
    • Contributors

    Using Datetime Expressions


    Article summary

    Learn how to modify and manipulate datetime data in Tulip using the Expressions Editor.

    When working with datetime data, you may want to alter it in your application. Using expressions, you can add or subtract a given duration of time, round the datetime to a given unit, or use a typecasting expression to change the data type. Let’s examine these scenarios and how you can use expressions to modify your datetime data.

    NOTE: For some of these expressions, you are required to include a timezone in the expression. View this website for a list of supported timezones.


    add_time()
    Adds a given duration unit to a given time

    Datetime Expressions - add_time ex

    subtract_time()
    Subtracts a given duration unit from a given time

    Datetime Expressions - subtract_time ex

    Datetime Expressions - add subtract_time ex

    rounddatetime()
    Truncates a date to the given unit

    Datetime Expressions - rounddatetime ex

    Using the above expression, the datetime will round to the nearest day like so:

    Datetime Expressions - rounddatetime ex in app

    Typecasting Datetime

    The following expressions typecast existing data types into different ones, changing the format and allowing you to use them in different contexts.

    datetimetotext()
    Changes a given datetime data type to a text data type

    datetimetotext expression ex

    datetimetotext expressions ex in app

    texttodatetime()
    Changes a given text data type to a datetime data type


    Did you find what you were looking for?

    You can also head to community.tulip.co to post your question or see if others have faced a similar question!


    Was this article helpful?