Skip to main content

mobilePickDate

Type

command

Summary

Allows the user to select the date, time or both the date and time (iOS Only) using the native device date picker.

Syntax

mobilePickDate [<style>] [, <current>] [, <start>] [, <end>] [, step] [, buttons]

Description

Allows the user to select the date, time or both the date and time (iOS Only) from the native date picker on the mobile device.

Use the mobilePickDate command to display a native date-picker-wheel on iOS or a native date picker dialog on Android. They allow the user to select the date, the time or both the date and time (iOS Only).

On the iPhone, a standard Action Sheet pops up containing the standard date-picker-wheel user interface element. On the iPad, a standard pop-over is presented with a list to choose from.

There are three modes of operation of the mobilePickDate command, depending on the value of style. If style is set to "date" the date picker allows the user to select a date, starting from the current date or a parameter set date. If style is set to "time" the date picker allows the user to select a time, starting from the current time or a parameter set time. If style is set to "dateTime" (iOS Only) the date picker allows the user to select a date and time, starting from the current date and time or a parameter set date and time.

Parameters

NameTypeDescription

style

enum

Indicates the mode of mobilePickDate. It determines whether mobilePickDate allows selection of "date", "time" or "dateTime" (iOS Only). The default style on iOS is "dateTime". The default style on Android is "date"

  • "datetime" (default on iOS) (iOS only): display a native picker to choose the date and time

current

The date, time or date and time that is to be displayed. If this is empty, then the current date time is used.

start

The start range of the date picker. If this value is empty, there is no lower boundary. The value is ignored if start is greater than end. Start and end parameters will be ignored on Android when picking 'time'.

end

The end range of the date picker. If this value is empty, there is no upper boundary. The value is ignored if start is greater than end. Start and end parameters will be ignored on Android when picking 'time'.

step (iOS Only): Specifies the minute interval size. This parameter is ignored if style is set to "date". The default is 1.

buttons (iOS Only) (enum): Specifies if "Cancel" and/or "Done" buttons should be forced to be displayed with the date picker dialog. The default behavior is device dependent, exhibiting the most native operation.

  • "done": display the Done button on the Date Picker
  • "cancelDone": display the Cancel and Done buttons on the Date Picker
  • "cancel": display the Cancel button on the Date Picker

Examples

mobilePickDate "date"
mobilePickDate "time",,,,10
mobilePickDate "time",,,,10, "cancelDone"
on displayDate
local tSelected, tRangeStart, tRangeEnd, tInterval, tDateResult

put "07/29/2011" into tSelected
-- the date and time selected by default
put "07/20/2011" into tRangeStart
-- the minimum date and time that can be selected
put "08/01/2011" into tRangeEnd
-- the maximum date and time that can be selected
put 5 into tInterval

// launch the date and time picker
mobilePickDate "dateTime" \
, tSelected, tRangeStart, tRangeEnd, tInterval

// get the result
put the result into tDateResult

// check and display the result in the text field
if tDateResult is 0 then
put "No Selection Made" into field "DateField"
else
put tDateResult into field "DateField"
end if
end displayDate

command: mobilePick

Compatibility and Support

Introduced

LiveCode 4.6.4

OS

ios

android

Platforms

mobile

Thank you for your feedback!

Was this page helpful?