---
title: "Datetime expressions"
slug: "datetime-expressions"
updated: 2023-09-21T15:20:02Z
published: 2023-09-21T15:20:02Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.tulip.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Datetime expressions

*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](https://www.php.net/manual/en/timezones.php) for a list of supported timezones.

---

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

![Datetime Expressions - add_time ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Datetime%20Expressions%20-%20add_time%20ex.png)

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

![Datetime Expressions - subtract_time ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Datetime%20Expressions%20-%20subtract_time%20ex.png)

![Datetime Expressions - add subtract_time ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Datetime%20Expressions%20-%20add%20subtract_time%20ex.gif)

**rounddatetime()** Truncates a date to the given unit

![Datetime Expressions - rounddatetime ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Datetime%20Expressions%20-%20rounddatetime%20ex.png)

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

![Datetime Expressions - rounddatetime ex in app](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Datetime%20Expressions%20-%20rounddatetime%20ex%20in%20app.png)

## 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](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/datetimetotext%20expression%20ex.png)

![datetimetotext expressions ex in app](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/datetimetotext%20expressions%20ex%20in%20app.png)

**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](https://community.tulip.co/?utm_source=intercom&amp;utm_medium=article-link&amp;utm_campaign=all) to post your question or see if others have faced a similar question!
