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?
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.
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.
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).
// 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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With