Prototype
DATE_IN_TIMEZONE(datetime, [to_timezone], [from_timezone])
Converts a date time value from a timezone to another.
By default, the function assumes that the parameter datetime
is expresed in UTC, unless a different source timezone is specified using the from_timezone
parameter.
The datetime
must be a complete date expression in the format YYYY-MM-DD hh:mm:ss”.
Input Parameters
| | | | |
---|
datetime
| String | | Yes | Complete date expression in the format YYYY-MM-DD hh:mm:ss”. |
to_timezone
| String/Number | "UTC" | No | The destination timezone. It can be expressed as: A timezone region (e.g., Europe/Madrid ). Daylight Saving Time is applied if applicable. “UTC”: Refers to the Universal Coordinated Time. A numeric offset in the range [-12, 12]
|
from _timezone | String | "UTC" | No | The original timezone in which the datetime value is expressed. By default, the function assumes the input is in UTC unless another timezone is specified. Accepted formats: A timezone region (e.g., Europe/Madrid ). Daylight Saving Time is applied if applicable. “UTC”: Refers to the Universal Coordinated Time. A numeric offset in the range [-12, 12]
|
Return value
| |
---|
String | Datetime converted to the selected timezone in the format “YYYY-MM-DD hh:mm:ss” |
Execution
Always. Calculated on-the-fly whenever an ITEM of a FORM is changed (by means of form_set_answer(), or when the FORM is opened
Examples
| |
---|
DATE_IN_TIMEZONE("12/03/2025 12:33:24", "Europe/Madrid")
| Conversion of date 12/03/2025 12:33:24 from UTC to the timezone region Europe/Madrid . The function returns the value 12/03/2025 13:33:24 |
DATE_IN_TIMEZONE("12/04/2025 12:33:24", "Europe/Madrid")
| Conversion of date 12/03/2025 12:33:24 from UTC to the timezone region Europe/Madrid . The function returns the value 12/03/2025 14:33:24 , taking in to account the Daylight Saving Time of Spain. |
DATE_IN_TIMEZONE("12/04/2025 12:33:24", "UTC", "Europe/Madrid")
| Conversion of date 12/03/2025 12:33:24 from the timezone region Europe/Madrid to UTC. The function returns the value 12/03/2025 10:33:24 , taking in to account the Daylight Saving Time of Spain. |
DATE_IN_TIMEZONE("12/04/2025 12:33:24", 2)
| Conversion of date 12/03/2025 12:33:24 from UTC to the timezone region with offset 2. The function returns the value 12/03/2025 14:33:24 |