tags:

views:

50

answers:

3

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
Thank you very much!
lqf
You should accept his answer if you think that is the best answer.
thyrgle
@thyrgle: that sounds a little wrong :P
BoltClock
@BoltClock: Ok, I made it less funny now.
thyrgle
A: 

It is not possible, check out this forum link:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/51285-can-we-change-device-time-using-application.html

Russell
It's not a blog. It's a forum. ;-)
Jonny
hehe updated :P
Russell
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