Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:10:11+00:00 2026-06-11T21:10:11+00:00

What NSTimeZone value does an NSDateFormatter use if you don’t pass it in? I’d

  • 0

What NSTimeZone value does an NSDateFormatter use if you don’t pass it in? I’d like to either use the default timeZone value, or pass in a given one. I’d like to do something like this:

- (NSString *) announcementTime{
    NSTimeZone *defaultTimeZone;  // What does this become?
    [self announcementTimeInTimeZone:defaultTimeZone];
}

- (NSString *) announcementTimeInTimeZone:(NSTimeZone *)timeZone{

  NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

  [formatter setDateStyle:NSDateFormatterNoStyle];
  [formatter setTimeStyle:NSDateFormatterShortStyle];
  [formatter setTimeZone:timeZone];

  return time;
}

What time zone do I want to pass in to my announcementTimeInTimeZone: method? Perhaps [NSTimeZone defaultTimeZone] or [NSTimeZone localTimeZone]. I’m just not sure what the default is and don’t see it documented anywhere.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:10:12+00:00Added an answer on June 11, 2026 at 9:10 pm

    I could not find any documentation either but I had a play in the debugger and it looks like NSDateFormatter uses defaultTimeZone.

    (lldb) p (NSTimeZone*)[f timeZone] (NSTimeZone *) $1 = 0x0a926fa0
    @"Australia/Sydney"

    (lldb) p (NSTimeZone*)[NSTimeZone defaultTimeZone]
    (NSTimeZone *) $2 = 0x0a926fa0 @"Australia/Sydney"

    (lldb) po [NSTimeZone localTimeZone]
    (id) $2 = 0x0ab3bb10 Local Time Zone (Australia/Sydney (GMT+10:00) offset 36000)

    "f" is an NSDateFormatter created just with alloc – init.
    As you can see the two time zones are exactly the same, stored at the same address.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to do some timezone calculation, using the following API: NSTimeZone *some_time_zone =
I have a TimeZone as NSString value given as GMT-09:00. All I want is
I have the following code. NSDateFormatter *df = ...; [df setTimeZone:[NSTimeZone defaultTimeZone]]; [df setDateFormat:@yyyy-MM-dd'T'HH:mm:ss.SSSZZZ];
UILocalNotification *notif = [[cls alloc] init]; notif.fireDate = [self.datePicker date]; notif.timeZone = [NSTimeZone defaultTimeZone];
I need to convert this string date 2011-06-25T11:00:26+01:00 into a long like value. I
NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@dd-MM-YYYY HH:mm]; [formatter setTimeZone:[NSTimeZone systemTimeZone]]; If i
Why does the following iOS 4.2 code return two different times? NSTimeZone *gmt =
When I call NSTimeZone’s abbreviation method it returns GMT-07:00 . Then, when I use
I'm using an NSDateFormatter to format my date in SQLite table cell value. The
I use the following code to create an NSDate from string: NSDateFormatter *df =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.