Date, DateTime: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[file: | [[file:dateios.jpg|thumb|200px|Date on iOS]] | ||
[[file:timeios.jpg|thumb|200px|Time on iOS]] | |||
[[File:DateAndroid.png|thumb|200px|Date control on Android Chrome]] | [[File:DateAndroid.png|thumb|200px|Date control on Android Chrome]] | ||
Revision as of 19:22, 6 April 2015
Description
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.
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.
Properties
Standard properties are supported.
value | The date value of the control. To set at runtime:
Date1.value = "2014-05-23" DateTime1.value = "2014-05-23T14:03" Month1.value = "2014-05" Time1.value = "14:03" |
Events
Standard events are supported.
Example (Basic)
Rem Date Example - set to current date on start Function Form1_onshow() Date1.value = FormatDateTime(Date, "yyyy-mm-dd") DateTime1.value = FormatDateTime(Date,"yyyy-mm-dd") & "T" & FormatDateTime(Now,vbShortTime) End Function
Example (JavaScript)
// Date Example - set to current date on start Form1.onshow = function() { var dt = new Date(); var dd = '0'+dt.getDate().toString(); dd = dd.substr(dd.length-2,2); var mm = '0'+(dt.getMonth()+1).toString(); mm = mm.substr(mm.length-2,2); var yyyy = dt.getYear()+1900; var Today = yyyy + '-' + mm + '-' + dd; Date1.value = FormatDateTime (Today) }
Output
(value is set to "2011-10-12" for Date) (value is set to "2011-11-12T13:59:17.011" for DateTime)