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.
Parse and Format Date Function Calls
Functions to parse datetimes from strings, using a specified pattern, or produce a string from a datetime.
See SimpleDateFormat for all pattern possibilities.
parseDateTime[UTC]
Takes a string and tries to parse it. If it fails and a default value is specified, it returns the default value. Otherwise, an error is raised. The function parseDateTime
uses the user’s time zone and parseDateTimeUTC
uses the UTC calendar.
Input parameters
- a date Type: String
- a format Type: String
- a default value (optional) Type: DateTime
Output
The parsed date, or the default value if a date could not be parsed. Type: DateTime
|
|
returns
|
|
|
|
returns
|
|
formatDateTime[UTC]
Converts the datetime to a string, formatted according to the format parameter. Without the format parameter, a standard format is used. The function formatDateTime
uses the users calendar and formatDateTimeUTC
uses the UTC calendar.
Input parameters
- a date Type: DateTime
- a format (optional) Type: String
Output
A formatted representation of the datetime. Type: String
|
|
returns:
|
|
To get ‘1987-12-31T23:59:00’, you need to concatenate two formatDateTime[UTC] functions:
|
|
formatTime[UTC]
Converts the time part of datetime to a string in a standard format. formatTime
uses the users calendar and formatTimeUTC
uses the UTC calendar.
Input parameters
- a date Type: DateTime
Output
A formatted representation of the time part of the datetime value. Type: String
|
|
returns:
|
|
formatDate[UTC]
Converts the date part of datetime to a string in a standard format. formatDate
uses the users calendar and formatDateUTC
uses the UTC calendar.
Input parameters
- a date Type: DateTime
Output
A formatted representation of the date part of the datetime value. Type: String
|
|
returns:
|
|