Understand date and time in model driven apps

2025-03-18

In many professional scenarios, dates and times are processed. Dataverse offers various ways to store and display them, which often leads to confusion. If the data types are not set correctly at the beginning, it may cause difficulties later on. Here you will learn how to best handle date and time fields.

Understanding Date and Time

Dataverse provides several options for creating date and time fields. These differ in what data is actually stored, how it's displayed, and how it can be processed later. I’ve also encountered situations where I wanted to process two dates, only to find that the stored data didn't allow it or the technology—like calculated columns—simply didn’t support it. So what are the options?

In Dataverse and Model-Driven Apps, date fields effectively have two parameters: format and time zone adjustment. When creating a new column, there's also the data type, but this can't be set independently of the format.

There are two format settings: “Date and Time” and “Date Only.” Time zone adjustment can have up to three settings: “User local,” “Time Zone Independent,” and “Date Only.” The latter is only available if the format is also set to “Date Only.”

Format

The format determines how date and time fields are displayed or what can be entered in forms.

However, this only affects display and input. The underlying data is stored as a timestamp with date and time. Since you can't enter a time in Model-Driven Apps when using Date Only, the time component is set to 00:00.

Time Zone Adjustment

Time zone adjustment is what confuses most developers and causes the most problems. It determines how stored data is displayed across different time zones. The options are:

Many Possibilities

Taken on its own, the system doesn’t seem too complicated. The format determines what the user sees. Time zone adjustment defines whether the data is adjusted for time zones. However, this results in five configuration options: Datetime format with User local or TZI, and Date Only with User local, TZI, or Date Only adjustment. So which should you choose?

Essentially, there are only three relevant cases: Date Only, User local, or Time Zone Independent.

Format Input (UTC+2) Dataverse Output (UTC-5)
Date only/TZI 2025-03-21 2025-03-21T00:00 2025-03-21
Datetime/TZI 2025-03-21T23:11 2025-03-21T23:11 2025-03-21T23:11
Datetime/User local 2025-03-21T23:11 2025-03-21T21:11 2025-03-21T16:11

Input and output in Model-Driven App form.

What About the Other Options?

If you set both format and time zone adjustment to Date Only, only the date is stored with no time information. This can make sense but generally offers no advantage over Date Only with TZI. A downside is that calculated columns become limited—you can’t combine Date Only fields with TZI or User local fields.

You should absolutely avoid combining Date Only format with User local adjustment. Here, only the date is displayed, but time zone adjustment still happens in the background. If I’m in Germany and enter March 19, 2025, it is saved as 2025-03-19 00:00. Due to time zone conversion, it’s stored as 2025-03-18 23:00 UTC. I won’t notice because the display converts it back. But colleagues in the US will see March 18, 2025. This mismatch is usually not desired and can lead to misinformation.

Format Input (UTC+2) Dataverse Output (UTC-5)
Date only/Date only 2025-03-21 2025-03-21 2025-03-21
Date only/User local 2025-03-21 2025-03-20T22:00 2025-03-20

Avoid combining Date Only with User local.

Power Automate

So far, this only referred to input and display in Model-Driven Apps. But many applications run Power Automate flows in the background. It's important to know that Power Automate does not consider time zone adjustments when saving. Every input is saved exactly as passed, regardless of the user’s time zone. Only in the formatted output might the User local or Date Only format be applied. That’s why it's generally best to use the utcNow() function when setting dates in Power Automate. But this depends on the use case.

Format Input (UTC+2) Dataverse Output (UTC-5)
Date only/Date only 2025-03-21T23:11 2025-03-21T23:11 2025-03-21T23:11
Datetime/TZI 2025-03-21T23:11 2025-03-21T23:11 2025-03-21T23:11
Datetime/User local 2025-03-21T23:11 2025-03-21T23:11 2025-03-21T23:11

Power Automate stores data exactly as entered.

Conclusion

Dataverse offers a variety of ways to format date and time fields—with or without time zone adjustment. This can be confusing, but if you follow these best practices, you should be fine.


Comments

Leo Redlich
2025-03-31
Ein neuer Kommentar

Write a comment

Your email address will not be published. Required fields are marked with an *.