Behavior and format of the date and time field
Applies To: Dynamics CRM 2015
In Microsoft Dynamics CRM, the Date and Time data type is used in many system entity fields. For example, you can show when an account was last used in a marketing campaign or the date and time when a case was escalated. You can also create custom entities that include the date and time fields. Depending on what the field represents, you can choose several different field behaviors: User Local, Date Only or Time-Zone Independent.
Note
The User Local behavior is available in the previous Microsoft Dynamics CRM releases. The Date Only and Time-Zone Independent behaviors are only available if you’re using Microsoft Dynamics CRM Online, and if you have updated your organization to Microsoft Dynamics CRM Online 2015 Update 1.
In This Topic
Date and time field behavior and format
Set managed property to change date and time behavior
Date Only example: birthdays and anniversaries
Time-Zone Independent example: hotel check-in
Special considerations for date and time fields
Date and time field behavior and format
The following table contains information about the date and time field behavior and format.
Behavior |
Format |
Changing field’s behavior |
---|---|---|
User Local Note This is the behavior of all date and time fields in the previous releases.
|
Date Only - or - Date and Time |
In the user interface (UI), you can change certain out-of-the-box entity field’s behavior from the User Local to Date Only. For a list of entities and fields, see Changing the field behavior to Date Only on update. You can change the custom entity field’s behavior from the User Local to Date Only or to Time-Zone Independent. Changing the field behavior affects the field values that are added or modified after the field behavior was changed. The existing field values remain in the database in the UTC time zone format. To change the behavior of the existing field values from UTC to Date Only, you may need a help of a developer to do it programmatically. More information: MSDN: Convert existing date and time values in the database. Warning Before changing the behavior of a date and time field, you should review all the dependencies of the field, such as business rules, workflows, calculated fields, or rollup fields, to ensure that there are no issues as a result of changing the behavior. After changing the behavior of a date and time field, you should open each business rule, workflow, calculated field, and rollup field dependent on the field that you changed, review the information, and save it, to ensure that the latest date and time field’s behavior and value are used. You can restrict modifying the field’s behavior, by setting the CanChangeDateTimeBehavior managed property to False. More information: Set managed property to change date and time behavior |
Date Only
|
Date Only |
The Date Only behavior can’t be changed to other behavior types, once it’s set. |
Time-Zone Independent
|
Date Only - or - Date and Time |
The Time-Zone Independent behavior can’t be changed to other behavior types, once it’s set. |
Note
To create a field of type DateTime and specify a particular behavior, go to Settings > Customization > Customize the System > Components > Entities. Choose the entity you want and choose Fields. In the field’s definition, choose Date and Time in the Type drop-down list.
Set managed property to change date and time behavior
You can control whether or not date and time field behavior can be changed by using the Can change date and time behavior managed property. If you want to allow the field behavior change, you set the property to True, otherwise, set it t False.
Note
The property is available only if you are using Microsoft Dynamics CRM Online, and if you have updated your organization to Microsoft Dynamics CRM Online 2015 Update 1.
By default, for the out-of-the-box system entity date and time fields, the Can change date and time behavior managed property is set to False. For the custom date and time fields, by default, the property is set to True.
To set the managed property, do the following:
Go to Settings > Customizations.
Choose Customize the System > Components > Entities and then choose a particular entity and then choose Fields. Choose a field. On the command bar, choose More Actions and in the drop-down list, choose Managed Properties.
In the Set Managed Properties dialog box, choose the Can change date and time behavior property and choose True or False. Choose Set to save the settings.
The following screenshot shows the date and time manager property.
Date Only example: birthdays and anniversaries
The Date Only behavior is good for cases when information about the time of the day and the time zone isn’t required, such as birthdays or anniversaries. With this selection, all CRM users around the world see the exact same date value.
For example, Kevin and Nancy work in the Contoso Corp sales department. Dynamics CRM stores their customer and sales data. Kevin, based in New York (GMT-5), creates the contact record with the birthdate 4/1/1970, and assigns the record to Nancy. Nancy, based in Seattle (GMT-8), opens the record on March 31st and, because there is no time zone conversion to her local time zone, sees the contact’s correct birthdate as 4/1/1970. All other users of the system, regardless of location, see the birthdate as 4/1/1970 when they open the contact’s record
Time-Zone Independent example: hotel check-in
You can use this behavior when time zone information isn’t required, such as the hotel check-in time. With this selection, all CRM users around the world see the same date and time value.
For example, Lisa and Rebecca work for a hotel chain that uses Dynamics CRM to track reservations. Lisa is based in Seattle (GMT-8). Rebecca is based in New York (GMT-5). A customer calls Lisa to book a room in one of the company’s hotels in New York City. Lisa creates a new reservation record, sets the expected check-in time to 12/10/2014 at 11:00 AM, and saves the record. The customer arrives at the hotel in New York City at the expected time. Rebecca, at the local hotel’s front desk, views the reservation record and sees the expected check-in time as 12/10/2014 at 11:00 AM. She welcomes the customer to the hotel.
Special considerations for date and time fields
All system out-of-the-box and custom date and time fields support values earlier than 1900 by default
Starting with Microsoft Dynamics CRM Online 2015 Update 1, the date and time fields support values as early as 1/1/1753 12:00 AM.
Ensuring calculated and rollup fields are valid after changing the field’s behavior
After changing the behavior of a calculated field or a rollup field, save the field definition to ensure the field is still valid. To save, use the field editor. Choose Settings > Customization > Customize the System > Components > Entities > Entity X > Fields. On the field’s form, choose the Edit button next to the Field Type drop-down list. More information: Define calculated fields and Define rollup fields.
Changing the field behavior to Date Only on update
By default, the Created On and Modified On date and time fields for the out-of-box system entities and custom entities are set to the User Local behavior. The CanChangeDateTimeBehavior managed property for these fields is set to False. You can’t change the behavior for these fields.
By default, in the new subscriptions to the Microsoft Dynamics CRM Online and CRM Online 2015 Update 1, the following out-of-box date and time fields in are set to Date Only behavior, and the CanChangeDateTimeBehavior managed property is set to False.
Field name |
Entity name |
---|---|
Anniversary |
Contact |
Birthdate |
Contact |
Due Date |
Invoice |
Est. Close Date |
Lead |
Actual Close Date |
Opportunity |
Est. Close Date |
Opportunity |
Final Decision Date |
Opportunity |
Valid From |
Product |
Valid To |
Product |
Closed On |
Quote |
Due By |
Quote |
On the update of your Microsoft Dynamics CRM Online organization to Microsoft Dynamics CRM Online 2015 Update 1, the fields listed above are set to User Local and the CanChangeDateTimeBehavior managed property is set to True. You can change the behavior of these fields to Date Only after you upgrade. No other behavior transitions are allowed. After updating the behavior of a field, you must publish the customizations for the change to take effect. Updating the behavior of a date and time field ensures that all the values entered or updated after the field behavior was changed are stored in the database with the new behavior. This doesn’t affect the values that are already stored in the database.
Date and time query operators not supported for Date Only behavior
The following date and time related query operators are invalid for the Date Only behavior. The time zone conversion doesn’t occur and the time is always set at 12:00 AM. An invalid operator exception error is thrown when one of these operators is used in the query.
Older Than X Minutes
Older Than X Hours
Last X Hours
Next X Hours
This applies to the follow locations in the UI:
Advanced Find
Saved View Editor
Query CRM Step on a Dialog
Outlook Client Offline Filters Editor
Report Wizard
Custom Filters on a column in Advanced Find
The date and time field behavior changes during a solution import
During a solution import, you can only change a date and time field’s behavior from User Local to Date Only or Time Zone Independent if you’re importing an unmanaged solution or a managed solution that owns the field.
See Also
Create and edit fields
Define calculated fields
MSDN: Behavior and format of the date and time attribute
© 2016 Microsoft Corporation. All rights reserved. Copyright