DateEdit.DateTime Property

Gets or sets the date/time value in the control.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll


public DateTime DateTime { get; set; }
Public Property DateTime As Date

Property Value

Type Description

A DateTime object representing selected date/time value.


The DateEdit control has four interconnected properties that specify what value the editor stores and what text it shows to users at runtime.


(the DateEdit.Text property)

A string value that is the text displayed inside the editor's text box. Normally, this is the editor's edit value converted to text with the ToString() method. To modify this text, use Format Specifiers and Masks, or handle the BaseEdit.FormatEditValue event.

The code sample below illustrates two ways to make the DateEdit display its text in the "dd MMMM, yyyy" format (e.g., "22 March, 2019").

dateEdit1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
dateEdit1.Properties.DisplayFormat.FormatString = "dd' 'MMMM', 'yyyy";


dateEdit1.FormatEditValue += DateEdit1_FormatEditValue;
private void DateEdit1_FormatEditValue(object sender, DevExpress.XtraEditors.Controls.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) {

Edit Value

(the DateEdit.EditValue property)

The value stored within the editor. Specifies the currently selected date. The editor's text box shows the textual representation of this value.

Edit value changes only when a user selects a single date. When users select time intervals that include multiple days (see the RepositoryItemDateEdit.SelectionMode property), the edit value does not update.

When the edit value is about to change, the cancelable DateEdit.EditValueChanging event fires. If it was not cancelled and the new edit value is accepted, the DateEdit.EditValueChanged occurs afterwards. When users type text in the editor's text box, these events fire when the focus moves from one date "portion" to another. For example, the animation below illustrates that the Changing\Changed event pair fires three times when a user edits "MM/DD/YYYY"-formatted dates.

You can set the DateEdit.Properties.EditValueChangedFiringMode property to Buffered to force the Changing\Changed events to fire when a user stops typing text, before they move focus to another date "portion".

Date Time

(the DateEdit.DateTime property)

Similar to the Edit Value, stores the currently selected date and does not change when users select multiple time intervals. Returns a DateTime structure instead of an Object.

This property cannot be bound to a data source field. If you need the editor to display values from a data source, bind the EditValue property instead.

EditValue and DateTime properties are synced: when either of them changes, the other property is updated as well.

Selected Ranges

(the DateEdit.SelectedRanges property)

Stores selected date intervals. Since EditValue and DateTime properties store only single-date selection values, use this collection to get or set selected DateTime values when the RepositoryItemDateEdit.SelectionMode property is set to Multiple.


The code sample below illustrates how to set the current date in a date edit when a user presses CTRL+N.

using DevExpress.XtraEditors;

dateEdit1.KeyDown += DateEdit1_KeyDown;

private void DateEdit1_KeyDown(object sender, KeyEventArgs e)
    DateEdit control = sender as DateEdit;
    if (e.KeyCode == Keys.N && e.Control)
        control.DateTime = DateTime.Now;
See Also