Mendix 7 is no longer supported unless you have Extended Support (for details, please contact Mendix Support). Mendix 7 documentation will remain available for customers with Extended Support until July, 2024.

Date Creation

Last modified: August 5, 2022

Date-type variables for a certain date can be created by using parseDateTime. This takes a date string and a format string as parameters and returns a date-type variable. For more details, see parseDateTime.

String variables representing a date can be created with the dateTime and dateTimeUTC functions. The difference between these two functions 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, but this can be configured in the Project Settings.

These functions take between 1 and 6 input parameters and return a string. These represent, in order:

  1. Years
    • Type: integer, four digits, and greater than 1799
  2. Months
    • Type: integer, between 1 and 12
  3. Days
    • Type: integer, between 1 and 31
  4. Hours
    • Type: integer, between 0 and 23
  5. Minutes
    • Type: integer, between 0 and 59
  6. Seconds
    • Type: integer, between 0 and 59

One parameter:

1
dateTime(2007)

returns:

1
"Mon Jan 01 00:00:00 CET 2007"

Two parameters:

1
dateTime(2007, 1)

return:

1
"Mon Jan 01 00:00:00 CET 2007"

Three parameters:

1
dateTime(2007, 1, 1)

return:

1
"Mon Jan 01 00:00:00 CET 2007"

Four parameters:

1
dateTime(2007, 1, 1, 1)

return:

1
"Mon Jan 01 01:00:00 CET 2007"

Five parameters:

1
dateTime(2007, 1, 1, 1, 1)

return:

1
"Mon Jan 01 01:01:00 CET 2007"

Six parameters:

1
dateTime(2007, 1, 1, 1, 1, 1)

return:

1
"Mon Jan 01 01:01:01 CET 2007"