Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving current local time on iPhone?

I'm looking to get the current hour and minute on a user's iPhone for display in an app that doesn't show the status bar. Is there a simple way to do this?

like image 328
user21293 Avatar asked Feb 19 '09 17:02

user21293


People also ask

How do I get my iPhone to show local Time?

On your iPhone, iPad or iPod touchGo to Settings > General > Date & Time. Turn off Set Automatically. Now you can change the time zone or the date and time: Tap Time Zone and enter a city with the time zone that you need.

Can you see Time history on iPhone?

Head over to “Settings” from the home screen of your iPhone or iPad. In the settings menu, scroll down and tap on “Screen Time”. Here, tap on “See All Activity” located right below the graph.

What Time will my iPhone change for Daylight Savings 2022?

In 2022, daylight saving time in the United States will begin on Sunday, March 13 and end on Sunday, November 6. On the former date, the time across the country will skip straight from 1:59 a.m. to 3 a.m. (except in Hawaii and Arizona, which don't make the adjustment).


1 Answers

// get current date/time NSDate *today = [NSDate date]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // display in 12HR/24HR (i.e. 11:25PM or 23:25) format according to User Settings [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; NSString *currentTime = [dateFormatter stringFromDate:today]; [dateFormatter release]; NSLog(@"User's current time in their preference format:%@",currentTime); 
like image 69
mixolution Avatar answered Oct 05 '22 15:10

mixolution