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 |
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:
- If the format is Date Only, Time Zone Behavior options are:
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)) |
- If the format is Date and Time, Time Zone Behavior options are:
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.
- My current time zone:
(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi
- User Test06’s time zone:
(GMT+04:00) Baku
(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 |
(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 |
(3) Check Database
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:
- Fields with User Local are stored in UTC, hence the offset.
- Fields with Time-Zone Independent or Date Only store exactly as entered.
(4) Different User View (Test06)
User Test06 (time zone (GMT+04:00) Baku
) sees:
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:
- Last X hours
- Next X hours
- X hours ago
Example query results in error 2147779605 The operator is not valid or it is not supported.
How to Set User Time Zone
Settings → Personalization Settings → General Tab → Choose Time Zone
Comments