import os
import sys
def main():
...
startApplication(...)
...
o = waitForObject({"type": "UIDatePicker", "visible": 1})
comps = get_uidatepicker_date_components(o)
test.log(str(comps.hour))
def get_uidatepicker_date_components(obj):
# UIDatePicker documentation:
# https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDatePicker_Class/Reference/UIDatePicker.html
# Supported components:
# era, year, month, date, day,
# hour, minute, second, week, weekday,
# weekdayOrdinal, quarter, calendar, timeZone
#
# Component (NSDateComponents) documentation:
# https:://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSDateComponents
c = obj.calendar
d = obj.date
return c.components_fromDate_(-1, d)