Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get time from datePicker and run method in this time ?

i want to get time from datePicker into NSDate object, and then to run a method every day in this time. for example: the user put in the datePicker the tome 08:00 and every day in 08:00 the application will run some method.

Thank you very much, Amir Foghel

like image 700
Amir Foghel Avatar asked Aug 09 '11 11:08

Amir Foghel


People also ask

How do I get time from date picker?

timePicker = new DateTimePicker(); timePicker. Format = DateTimePickerFormat. Time; timePicker.

What is a date time picker?

The DateTimePicker control is used to allow the user to select a date and time, and to display that date and time in the specified format. The DateTimePicker control makes it easy to work with dates and times because it handles a lot of the data validation automatically.

How to open Date Picker in android?

Android Date Time Picker Dialog Project CodegetInstance() to display the current date and time using the respective static fields. Note: The display calendar and clock are the default UI themes as provided in the AppCompat Theme. Below is the output produced by our android date time picker example application.

How to add Date Picker in Java?

final DatePicker datePicker = new DatePicker(); datePicker. setOnAction(new EventHandler() { public void handle(Event t) { LocalDate date = datePicker. getValue(); System.


1 Answers

To get the time from datepicker use ,

NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"HH:mm"]; //24hr time format
NSString *dateString = [outputFormatter stringFromDate:self.myDatePicker.date];
[outputFormatter release];

To do a functionality at particular time daily use UILocalNotification.

Set the repeatInterval as NSDayCalendarUnit.

And in the delegate to handling the UILocalNotification code your method.

NOTE: This method will be execute only when the user accepts the Local notification.

like image 135
KingofBliss Avatar answered Sep 28 '22 14:09

KingofBliss