If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.
Date Creation
Introduction
Dates can be created with the dateTime
and dateTimeUTC
functions. The difference between them is that dateTime
uses the calendar of the session used in the function call, and dateTimeUTC
uses the UTC calendar. The system session runs as UTC by default, except for scheduled events, which can be configured in the Scheduled Event Time Zone section of Project Settings.
This function does not accept variable or attribute parameters, only fixed values. To create a date using parameters, use the parseDateTime function.
Values
These functions take between one and six input values in the following order:
- years (type: integer, four digits and greater than 1799)
- months (type: integer, between 1 and 12)
- days (type: integer, between 1 and 31)
- hours (type: integer, between 0 and 23)
- minutes (type: integer, between 0 and 59)
- seconds (type: integer, between 0 and 59)
Examples
The examples below illustrate which value the expression returns:
-
If you specify one value as an input:
dateTime(2007)
The expression will return the following output:
"Mon Jan 01 00:00:00 CET 2007"
-
If you specify two values as an input:
dateTime(2007, 1)
The expression will return the following output:
"Mon Jan 01 00:00:00 CET 2007"
-
If you specify three values as an input:
dateTime(2007, 1, 1)
The expression will return the following output:
"Mon Jan 01 00:00:00 CET 2007"
-
If you specify four values as an input:
dateTime(2007, 1, 1, 1)
The expression will return the following output:
"Mon Jan 01 01:00:00 CET 2007"
-
If you specify five values as an input:
dateTime(2007, 1, 1, 1, 1)
The expression will return the following output:
"Mon Jan 01 01:01:00 CET 2007"
-
If you specify six values as an input:
dateTime(2007, 1, 1, 1, 1, 1)
The expression will return the following output:
"Mon Jan 01 01:01:01 CET 2007"