Your search did not match any results.
Date Box

Overview

Documentation
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.
Copy to Codepen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { var now = new Date(); $scope.dateBox = { dateFormat: { type: "date", value: now }, timeFormat: { type: "time", value: now }, dateTimeFormat: { type: "datetime", value: now }, customFormat: { displayFormat: "EEEE, MMM dd", value: now }, dateByPicker: { pickerType: "rollers", value: now }, disabled: { type: "datetime", disabled: true, value: now }, clear: { type: "time", showClearButton: true, value: new Date(2015, 11, 1, 6) }, eventOptions: { applyValueMode: "useButtons", value: new Date(1981, 3, 27), max: new Date(), min: new Date(1900, 0, 1), bindingOptions: { value: "dateBox.eventOptions.value" }, diffInDay: function() { return Math.floor(Math.abs((new Date() - $scope.dateBox.eventOptions.value)/(24*60*60*1000))) + " days"; } } }; });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="js/jquery-3.1.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/event.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/supplemental.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/unresolved.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/message.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/number.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/currency.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/date.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.light.css" /> <link rel="dx-theme" data-theme="android5.light" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.android5.light.css" /> <link rel="dx-theme" data-theme="ios7.default" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.ios7.default.css" /> <link rel="dx-theme" data-theme="win10.black" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.win10.black.css" /> <link rel="dx-theme" data-theme="win10.white" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.win10.white.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C\/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/16.2.6/js/dx.all.js"></script> <link rel="stylesheet" type ="text/css" href ="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Date</div> <div class="dx-field-value"> <div dx-date-box="dateBox.dateFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Time</div> <div class="dx-field-value"> <div dx-date-box="dateBox.timeFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Date and time</div> <div class="dx-field-value"> <div dx-date-box="dateBox.dateTimeFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Custom format</div> <div class="dx-field-value"> <div dx-date-box="dateBox.customFormat"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Date picker</div> <div class="dx-field-value"> <div dx-date-box="dateBox.dateByPicker"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> <div dx-date-box="dateBox.disabled"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Clear button</div> <div class="dx-field-value"> <div dx-date-box="dateBox.clear"></div> </div> </div> </div> <div class="dx-fieldset"> <div class="dx-fieldset-header">Event Handling</div> <div class="dx-field"> <div class="dx-field-label">Set Birthday</div> <div class="dx-field-value"> <div dx-date-box="dateBox.eventOptions"></div> </div> </div> <div class="dx-field"> <div class="dx-field-value"> Your age is <div id="age">{{dateBox.eventOptions.diffInDay()}}</div> </div> </div> </div> </div> </body> </html>
#age { display: inline-block; }