D365 – Date and Time Fields

Introduction

This article documents the usage and fundamental concepts of Date and Time fields in Dynamics CRM.

Basic Concepts

Dataverse stores all date and time values in the UTC time zone. When applications display values or process user inputs, Dataverse and model-driven apps can use the Format option to adjust according to the user’s time zone.

Creating a “Date and Time” Field

When creating a Date and Time field in an entity, you can choose the following formats: Date Only or Date and Time.

Format Description
Date Only Displays only the date portion. The time value is stored in the system as 12:00 AM (00:00:00)
Date and Time Displays full date and time values

Select “Format” for Date and Time field

When creating a Date and Time field, the Advanced Options allow you to configure Time Zone Behavior. The available options vary depending on the selected format:

Time Zone Behavior Description
User Local Default. Adjusts values based on the user’s time zone
Time-Zone Independent Displays values without time zone conversion
Date Only No time zone conversion. Unlike Time-Zone Independent, time is not stored (always saved as 12:00 AM (00:00:00))
Time Zone Behavior Description
User Local Default. Adjusts values based on the user’s time zone
Time-Zone Independent Displays values without time zone conversion

Note: After creation, both “Format” and “Time Zone Behavior” can still be modified in a solution.

Can “Format” and “Time Zone Behavior” Be Changed Later?

The following table summarizes whether existing fields allow changes:

Format & Time Zone Behavior Format Time Zone Behavior
Date Only - User Local Yes Yes
Date Only - Time-Zone Independent Yes No
Date Only - Date Only No No
Date and Time - User Local Yes Yes
Date and Time - Time-Zone Independent Yes No

How to Choose Time Zone Behavior?

Option Description
Time-Zone Independent Use when time zone is irrelevant (e.g., hotel check-in, invoice payment). All users will see the same value regardless of time zone.
Date Only Use when only the date matters (e.g., birthdays, anniversaries). All users will see the same date value.

Notes

# Description
1 “Date Only - Time-Zone Independent” and “Date Only - Date Only” behave similarly. If unsure whether time parts (HH:mm:ss) may be needed later, choose Date Only - Time-Zone Independent.
2 Since User Local is the default, carefully consider requirements before choosing Date Only or Time-Zone Independent, otherwise users across time zones may see different dates due to ±8 hours conversion.

Small Experiment

In the Invoice entity, I added 5 “Date and Time” fields and tested how they are stored.

(1) Create Fields

Display Name Schema Name Format Time Zone Behavior
D - User Local gdh_d_userlocal Date Only User Local
D - TZ Independent gdh_d_tz_independent Date Only Time-Zone Independent
D - D gdh_d_d Date Only Date Only
DT - User Local gdh_dt_userlocal Date and Time User Local
DT - TZ Independent gdh_dt_tz_independent Date and Time Time-Zone Independent

5 Date and Time fields

(2) Enter Values in Form

In (GMT+08:00) Beijing time zone:

Field Value
D - User Local 2025-03-10
D - TZ Independent 2025-03-12
D - D 2025-03-14
DT - User Local 2025-03-10 14:30
DT - TZ Independent 2025-03-24 09:30

Assign values to Date and Time fields

(3) Check Database

Check database data

Field Entered Value Stored Value
D - User Local 2025-03-10 2025-03-09 16:00:00.000
D - TZ Independent 2025-03-12 2025-03-12 00:00:00.000
D - D 2025-03-14 2025-03-14 00:00:00.000
DT - User Local 2025-03-10 14:30 2025-03-10 06:30:00.000
DT - TZ Independent 2025-03-24 09:30 2025-03-24 09:30:00.000

Explanation:

(4) Different User View (Test06)

User Test06 (time zone (GMT+04:00) Baku) sees:

Test06 viewing data

Example: D - User Local stored as UTC 2025-03-10 06:30:00. Converted to (GMT+04:00) becomes 2025-03-10 10:30:00.

(5) Client API Access

Code samples showing getValue() differences for User Local vs Time-Zone Independent.

(6) Web API Access

Retrieving via Web API returns the same raw values as stored in the database.


Unsupported Query Operators

“Date Only” fields do not support operators like:

Example query results in error 2147779605 The operator is not valid or it is not supported.

Error example

How to Set User Time Zone

Settings → Personalization Settings → General Tab → Choose Time Zone

Set user time zone

References

  1. Create and edit Dataverse columns using Power Apps solution explorer (CN)
  2. Column Data Types (EN)

Copyright Notice

Author: Donghai

Link: https://gdhblog.com/posts/d365/date-time-fields/

License: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

Comments

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut