UIDatePicker: time mode: initializes the time (must be simple)

advertisements

All,

This seems like such a simple thing, but I cannot find* the right method to create a UIDatePicker, in time mode, and have it initialized to a specific time. I don't want date -- just time (think alarm clock). I have created a NSDate object:

NSDate * date = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate: (NSTimeInterval) delta];
pickerView = [[UIDatePicker alloc] init];  // which should be 'now' right?
pickerView.datePickerMode = UIDatePickerModeTime;  // which creates just the clock
[pickerView setDate:date];

and in the first line, the interval (delta) is zero. It displays 7:00PM.

This has gotta be so simple that I'm missing it, but I can't find the right way -- anyone?

Thank you in advance!

:bp:

*yes, I have looked, but apparently not in the correct places :(


Take the time zone into account. You will get 0AM only if you are at UTC.