--- title: "Datetime Expressions" slug: "datetime-expressions" updated: 2023-10-31T15:24:11Z published: 2023-10-31T15:24:11Z canonical: "support.tulip.co/datetime-expressions" --- > ## 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. # 使用日期时间表达式 *了解如何使用表达式编辑器在 Tulip 中修改和操作日期时间数据。* 在使用日期时间数据时,您可能希望在应用程序中对其进行修改。使用表达式,您可以添加或减去给定的时间长度,将日期时间四舍五入到给定的单位,或使用类型转换表达式更改数据类型。让我们来看看这些应用场景以及如何使用表达式修改日期时间数据。 注意:对于某些表达式,您需要在表达式中包含时区。请访问[本网站](https://www.php.net/manual/en/timezones.php),查看支持的时区列表。 --- **add_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()**从给定时间中减去给定时长单位 ![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()**将日期截断到给定单位 ![Datetime Expressions - rounddatetime ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Datetime%20Expressions%20-%20rounddatetime%20ex.png) 使用上述表达式,日期时间将四舍五入到最接近的一天,就像这样: ![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) ## 类型转换日期时间 以下表达式将现有数据类型类型化为不同的类型,改变格式并允许您在不同的上下文中使用它们。 **datetimetotext()**将给定的日期时间数据类型转换为文本数据类型 ![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()**将给定的文本数据类型转换为日期时间数据类型 --- 找到你想要的了吗? 你还可以前往[community.tulip.co](https://community.tulip.co/?utm_source=intercom&utm_medium=article-link&utm_campaign=all)发布你的问题,或查看其他人是否遇到过类似问题!