API Documentation
Documentation for developing SailfishOS applicationsTimePicker QML Type
A clock face for selecting a time More...
Import Statement: | import Sailfish.Silica 1.0 |
Properties
Detailed Description
The TimePicker type enables the user to change the time within a clock-face interface.
Here is a simple time picker with its time set to 13:30 (or 1:30pm in 12-hour mode):
import Sailfish.Silica 1.0 TimePicker { hour: 13 minute: 30 }
If the hour or minute are not set, they default to 0.
When the user changes the time displayed by the clock face, the hour and minute properties are updated appropriately. If hourMode is set to DateTime.TwelveHours
, the hour is adjusted appropriately for 12-hour mode.
For convenience, the TimePickerDialog type presents a time picker within a dialog. If you simply need to request a time value from the user, you may find it useful to present a TimePickerDialog rather than inserting a TimePicker item into your user interface.
See also TimePickerDialog and DatePicker.
Property Documentation
The value of the hour indicator in the displayed clock face.
This is a number in the range 0-23 if hourMode is DateTime.TwentyFourHours, or in the range 0-12 if hourMode is DateTime.TwelveHours. The default value is 0.
If this is set to a number outside of the valid range according to the current hourMode, the value is adjusted to the closest value within the valid range.
See also hourMode.
Controls the range of values for the hour property. This may be set to one of the following:
- DateTime.DefaultHours - Uses either 24-hour or 12-hour mode based on system settings. Default value.
- DateTime.TwentyFourHours - 24-hour mode. The valid range for hour is 0-23.
- DateTime.TwelveHours - 12-hour mode. The valid range for hour is 0-12.
If hourMode changes to DateTime.TwelveHours
while the hour is in the range 13-23, the hour is adjusted accordingly. For example, an hour value of 14
would become 2
in 12-hour mode, since a time of "14:00 hours" is represented in 12-hour mode as "2:00pm".
The value of the minute indicator in the displayed clock face.
This is a number in the range 0-59. The default value is 0.
If this is set to a number outside of the valid range (0-59), the value is adjusted to the closest value within the valid range.
Reports the currently selected time as a JavaScript date object.
The date of the object is set to Jan 1, 1970.
Reports the currently selected date as a formatted time string, in "hh:mm" format. If hourMode is DateTime.TwelveHours, an AM/PM indicator is included.
For example, if hour is 16, minute is 30 and hourMode is DateTime.TwelveHours, the timeText
would be "4:30 pm". For an hourMode of DateTime.TwentyFourHours, this would be "16:30" instead.