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.
XPath Week-from-DateTime
Overview
The week-from-dateTime()
function extracts the week number (in the year) from a Date and time attribute so it can be used to compare to a value. Values range from 1 to 53.
The value returned depends on which database is being used to support your Mendix app. It does not take into account the app runtime setting First day of the week.
Many databases implement ISO 8601, but please refer to the documentation for the database you are using to find the exact details.
Example
This query returns all the logs where the date DateAttribute
falls in the second week of the year (for example, “2011-01-13”):
//Logging.Log[week-from-dateTime(DateAttribute) = 2]
Read More
The following links are for the relevant documentation on how week number is calculated for a specific date for many of the databases used with Mendix.
The HSQLDB database used for testing locally uses JVM’s Calendar.WEEK_OF_YEAR.
PostgreSQL, Oracle, and MySQL follow ISO 8601:
Other databases have a more specific behavior: