DateTime
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
A DateTime field can be formatted to show both the date and time, or the date only. The following properties are available:
| DateTime properties | Type | Description |
| {Field}.DataValue | Date or Null | Get/set property.
The original value is left unchanged if the new value cannot be parsed. |
| {Field}.TimeVisible | Boolean | Get property.
This property specifies if the time is to be shown. |
Example
The following code example shows how to use a field of type DateTime.
var oDate;
var oToday;
oDate = crmForm.all.scheduledend.DataValue;
if (oDate == null) {
oDate = new Date();
}
oToday = new Date();
oDate = oToday;
oDate = oDate.setHours(17,0,0);
if (oDate.TimeVisible)
{
alert("The time is visible.");
}
else
{
alert("Only the date is visible; the time is hidden.");
}
crmForm.all.scheduledend.DataValue = oDate;
See Also
Concepts
Other Resources
.gif)