π Description / Problem
In Mendix, standard DateTime helper functions like beginOfWeek() can return incorrect results in applications that intentionally store and process timestamps in UTC, because the outcome depends on runtime/user timezone localization.
This becomes critical when a UTC DateTime is close to midnight.
Real example
Timestamp: Sunday 23:30 UTC
In CET/CEST, this instant may be interpreted as Monday
Result: beginOfWeek() may return a different week than expected for a system that must calculate week boundaries strictly in UTC.
π This makes weekly grouping, reporting, and planning calculations unreliable in UTC-based systems.
π― Why this matters (Use cases)
This impacts key enterprise use cases such as:
β Weekly KPIs and reporting (dashboards, Power BI, analytics)
β Planning and scheduling logic (weekly planning, capacity horizons)
β Calculation engines and backend automation jobs relying on consistent periods
β Integrations with ERPs/APIs that exchange timestamps in UTC
β Multi-country / multi-timezone applications where each user has a different offset
When an application chooses UTC to ensure consistency, the current behavior forces period calculations to depend on local timezone shifts, which defeats the purpose.
β Requested Improvement (Proposal)
1) Add built-in UTC-safe helper functions
Add a standard set of UTC-safe functions that compute boundaries strictly in UTC, without applying localization/timezone conversion:
beginOfDayUTC(DateTime)
endOfDayUTC(DateTime)
beginOfWeekUTC(DateTime)
endOfWeekUTC(DateTime)
beginOfMonthUTC(DateTime)
endOfMonthUTC(DateTime)
Optionally (useful for reporting/UI scenarios):
ClientUtcOffsetHours() (informational helper)
FormatClientDateOnlyToString(DateTime)
FormatClientDateOnlyToStringUTC(DateTime)
2) Support a βUTC DateTimeβ attribute type (or flag) for entities
It would be very valuable to have a way to define a DateTime attribute as explicitly UTC-based, for example:
A new attribute type like DateTimeUTCor
A property/flag on DateTime attributes such as Store/Interpret as UTC (no localization)
This would prevent many subtle bugs caused by implicit timezone conversion in:
database reads/writes
microflow calculations
reporting queries
integrations
In short: the platform should allow developers to express the intent clearly:β βThis timestamp represents an absolute UTC moment and must not be localized.β
π Current workaround (what we implemented)
As a temporary solution, we implemented these as custom Java Actions to ensure correct UTC calculations:
beginOfDayUTC
endOfDayUTC
beginOfWeekUTC
endOfWeekUTC
beginOfMonthUTC
endOfMonthUTC
ClientUtcOffsetHours
FormatClientDateOnlyToString
FormatClientDateOnlyToStringUTC
This works, but we strongly believe this should be part of Mendix standard capabilities, since it affects many real projects using UTC for integrations, reporting, and calculation engines.
β Value for the Mendix ecosystem
Adding this to the platform would provide:
Fewer hard-to-reproduce timezone bugs
Cleaner projects (no need for custom Java Actions)
Better support for enterprise/industrial use cases
More reliable reporting and planning engines
Predictable behavior in global deployments