DateEdit.DateOnly Property
Gets or sets the selected date as a System.DateOnly value.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v25.2.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
| Type | Description |
|---|---|
| DateOnly | The selected date. |
Remarks
Use MinDate and MaxDate properties to restrict the selectable date range.
EditValue, DateTime, and DateOnly property values are synchronized.
The following code snippet reads and sets the DateOnly value:
using DevExpress.XtraEditors;
using System;
dateEdit.DateOnly = DateOnly.FromDateTime(DateTime.Today);
DateOnly selected = dateEdit.DateOnly;
The DateEdit exposes a set of related properties that define the edit value and the displayed text.
EditValue
The DateEdit.EditValue property stores the current value. The DateEdit control displays this value as text in the edit box.
EditValue updates only when a user selects a single date. EditValue does not change in multi-selection mode.
The DateEdit control fires the following events in response to EditValue changes:
Typing triggers multiple change cycles. Each date segment update raises the event pair:

Set the DateEdit.Properties.EditValueChangedFiringMode property to Buffered to delay events until input completion.
DateTime
The DateEdit.DateTime property specifies a strongly typed DateTime value. It mirrors EditValue and ignores multiple date selection.
Do not bind the DateTime property. Bind EditValue to a data source instead.
DateOnly
The DateEdit.DateOnly property specifies a strongly typed DateOnly value. It mirrors EditValue and ignores multiple date selection.
Do not bind the DateTime property. Bind EditValue to a data source instead.
Text
The DateEdit.Text property gets the text displayed in the edit box. The control converts its EditValue to text with ToString().
Use Format Specifiers, Masks, or handle the FormatEditValue event to modify default formatting settings.
The following code snippet formats the display text as “dd MMMM, yyyy“ (for example, “22 March, 2019“):
using DevExpress.Utils;
using DevExpress.XtraEditors.Controls;
// #1 - Use format specifiers.
dateEdit1.Properties.DisplayFormat.FormatType = FormatType.DateTime;
dateEdit1.Properties.DisplayFormat.FormatString = "dd' 'MMMM', 'yyyy";
// #2 - Use event-based formatting.
dateEdit1.FormatEditValue += DateEdit1_FormatEditValue;
void DateEdit1_FormatEditValue(object sender, ConvertEditValueEventArgs e) {
try {
string day = ((DateTime)e.Value).Day.ToString();
string month = ((DateTime)e.Value).ToString("MMMM");
string year = ((DateTime)e.Value).Year.ToString();
e.Value = day + " " + month + ", " + year;
e.Handled = true;
}
catch (Exception) {
}
}
Synchronization
EditValue, DateTime, and DateOnly properties are synchronized. A change in one property updates other properties.
SelectedRanges
The DateEdit.SelectedRanges property stores selected date intervals. Use this property in multi-selection mode.
EditValue, DateTime, and DateOnly properties support single-date selection only. Use SelectedRanges to obtain selected dates when the SelectionMode property is set to Multiple.