Overview

The DateBox is a widget that displays date and time in a specified format, and enables a user to pick or type in the required date/time value.

View Demo

The following code adds a simple DateBox to your page.

HTML
<div id="dateBoxContainer"></div>
JavaScript
$(function() {
    $("#dateBoxContainer").dxDateBox({
        value: new Date(),
        type: "date"
    });
});

The DateBox accepts values of the following formats: dates, numeric values specifying the number of milliseconds since January 1, 1970, 00:00:00, and strings that match the following patterns: 'yyyy/MM/dd' or 'yyyy/MM/dd HH:mm:ss'. Note that in code the format stays the same until a value of a different format is assigned to the value option. For example, numbers remain numbers until you pass a string to the value option.

In addition, the DateBox supports several date and time types, that is, it can display only the date, only the time, or both. To specify the needed type, set the type option.

Depending on the platform, the DateBox provides different controls for picking values. See the Platform-Specific Value Pickers topic for details.

See Also