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.

OQL DATEPART

Last modified: August 2, 2022

The DATEPART function retrieves a specified element from a date/time values. This element is of type integer.

The syntax is as follows:

DATEPART ( datepart , date_expression )
datepart definition example when used for Friday July 1, 2005, 16:34:20
YEAR 2005
QUARTER 1, 2, 3 or 4 3
MONTH 1 to 12 7
DAYOFYEAR 1 to 366
DAY 1 to 31 5
WEEK 1 to 53 (depends on the database implementation)
WEEKDAY 1 to 7 (1 = Sunday, 7 = Saturday) 6
HOUR 0 to 23 16
MINUTE 0 to 59 34
SECOND 0 to 59 20

datepart Specifies the part of the date/time value to retrieve. This can be one of the following:

date_expression Specifies the date to retrieve an element from. This should be formatted in an expression which resolves to a date/time value.