The control UIDatePicker is perhaps the most beautiful present graphical control on the Apple iPhone. Besides the beauty of it is also easy to use, extremely versatile and used in many situations.

It is then imported able to "read" the date set in the control:
1 2 3 4 5 | / / This method works on both the simulator and the device (SDK 2.2.1) date = dateInsert.date; NSData * date = dateInsert.date; dateFormat = [ [ NSDateFormatter alloc ] init ] ; NSDateFormatter DateFormat = * [[ NSDateFormatter alloc] init]; @ "yyyy-MM-dd HH:mm" ] ; [DateFormat setDateFormat: @ "yyyy-MM-dd HH: mm"]; "Data formattata: %@" , [ dateFormat stringFromDate : date ] ) ; NSLog (@ "Data formatted:% @", [stringFromDate dateformat: date]); |
1 2 3 4 | / / This also works on both, and Device Simulator, but when you / / Fill the device emits a Warning / / Warning: 'NSData' May Not Respond to '-descriptionWithCalendarFormat: TimeZone: Local:' "Data formattata: %@" , [ dateInsert.date descriptionWithCalendarFormat : @ "%Y%m%d %H:%M" timeZone : nil locale : nil ] ) ; NSLog (@ "Data formatted:% @", [dateInsert.date descriptionWithCalendarFormat: @ "% Y% m% d% H:% M" timezone: nil zone: nil]); |










There are no comments for this post
Leave a comment