[[file:Datetime.jpg|||Date and Time on iOS]][[File:DateAndroid.png|307x325px|right|Date control on Android Chrome]]
[[file:Dateios.png|thumb|200px|Date on iOS]]
[[file:Timeios.png|thumb|200px|Time on iOS]]
[[File:DateAndroidMM.png|thumb|200px|Date control on Android Chrome]]
== Description ==
== Description ==
Line 7:
Line 9:
When the control is selected at runtime, a special date picker is displayed.
When the control is selected at runtime, a special date picker is displayed.
It is supported starting with iOS 5. It is not supported on Android at this time.
It is supported starting with iOS 5 and Android 4. Not supported in IE11 or Firefox.
To add a control to your app, choose the control’s icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the control: usually, just onclick.
To add a control to your app, choose the control’s icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the control: usually, just onclick.
Line 13:
Line 15:
== Properties ==
== Properties ==
Standard [[properties and methods|properties]] are supported.
Standard [[properties and methods|properties]] are supported, plus
{| class="wikitable"
{| class="wikitable"
|-
|-
| value || The date value of the control.
| max || The latest date in the format YYYY-MM-DD.
|-
For the Date control, use the format 2012-01-06.
| min || The earliest date in the format YYYY-MM-DD.
|-
For DateTime, use 2012-01-06T09:13:58
| value || The date value of the control. To set at runtime:
The Date and DateTime controls allow the input of a date. The result is returned as a string in value.
When the control is selected at runtime, a special date picker is displayed.
It is supported starting with iOS 5 and Android 4. Not supported in IE11 or Firefox.
To add a control to your app, choose the control’s icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the control: usually, just onclick.
// Date Example - set to current date on startForm1.onshow=function(){vardt=newDate();vardd='0'+dt.getDate().toString();dd=dd.substr(dd.length-2,2);varmm='0'+(dt.getMonth()+1).toString();mm=mm.substr(mm.length-2,2);varyyyy=dt.getYear()+1900;varToday=yyyy+'-'+mm+'-'+dd;Date1.value=FormatDateTime(Today)}// Get the date (month, day, year)Calendar1.onclick=function(){variDayOfMonth;variMonth;variYear;iDayOfMonth=$("#Calendar1").jqxCalendar("getDate").getDate();iMonth=$("#Calendar1").jqxCalendar("getDate").getMonth()+1;iYear=$("#Calendar1").jqxCalendar("getDate").getFullYear();TextBoxMonth.value=iMonth;TextBoxDay.value=iDayOfMonth;TextBoxYear.value=iYear;};ButtonSetDate.onclick=function(){$("#Calendar1").jqxCalendar("setDate",newDate());};
Rem Date Example - set to current date on startFunctionForm1_onshow()Date1.value=FormatDateTime(Date,"yyyy-mm-dd")DateTime1.value=FormatDateTime(Date,"yyyy-mm-dd")&"T"&FormatDateTime(Now,vbShortTime)EndFunctionRem Get the date (month, day, year)FunctionCalendar1_onclick()DimiDayOfMonthDimiMonthDimiYeariDayOfMonth=$("#Calendar1").jqxCalendar("getDate").getDate()iMonth=$("#Calendar1").jqxCalendar("getDate").getMonth()+1iYear=$("#Calendar1").jqxCalendar("getDate").getFullYear()TextBoxMonth.value=iMonthTextBoxDay.value=iDayOfMonthTextBoxYear.value=iYearEndFunctionFunctionButtonSetDate_onclick()$("#Calendar1").jqxCalendar("setDate",newDate())EndFunction
Output
(value is set to "2011-10-12" for Date)
(value is set to "2011-11-12T13:59:17.011" for DateTime)