Hello All: I want to set the time of system in the iphone application,but i don't know how to do. Would you know? Please tell me,thank you!
+2
A:
You can't, as there is no public API provided by Apple to do that. Even then, it's bad practice to try and change a user system setting like that.
BoltClock
2010-07-30 02:49:16
Thank you very much!
lqf
2010-07-30 03:03:14
You should accept his answer if you think that is the best answer.
thyrgle
2010-07-30 03:10:09
@thyrgle: that sounds a little wrong :P
BoltClock
2010-07-30 03:11:14
@BoltClock: Ok, I made it less funny now.
thyrgle
2010-07-30 03:15:10
A:
Alternative: Use an NSDate and then modify it accordingly.
NSDate* now = [NSDate date];
int hour = [[now dateWithCalendarFormat:nil timeZone:nil] hourOfDay];
int min = [[now dateWithCalendarFormat:nil timeZone:nil] minuteOfHour];
int sec = [[now dateWithCalendarFormat:nil timeZone:nil] secondOfMinute];
NSLog(@"%d / %d / %d", hour+offset1, min+offset2, sec+offset2);
But you truly can't change the system clock. But, maybe this will help with what you want to do.
thyrgle
2010-07-30 02:52:45