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

  • Home
  • SEARCH
  • 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 7800139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:32:19+00:00 2026-06-02T00:32:19+00:00

I am using NSDate formatter to take a date in from a Facebook Graph

  • 0

I am using NSDate formatter to take a date in from a Facebook Graph API request (which is in GMT) and convert it to the local time zone of the user. I can read in the date fine and set its new time zone fine, but when I print out the new date, it does not seem to consider daylight savings time.

time below will actually come from the request but for example here I just enter in a standard time string from the Facebook response

NSString *time = @"2012-04-12T15:25:09+0000"
NSTimeZone *localZone = [NSTimeZone localTimeZone];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setTimeZone:localZone];
[formatter setDateFormat:@"yyyy-mm-dd'T'HH:mm:ssZZZZ"];
NSDate *date = [formatter dateFromString:time];
[formatter setDateFormat:@"eee MMM dd, yyyy hh:mm a"];
NSString *dateStr = [formatter stringFromDate:date];
NSLog(@"%@",dateStr);

When it prints this date it prints out “Thu Jan 12, 2012 10:25 AM” which for “America/New_York” time zone, which is where I am, that is wrong. I should be “Thu Jan 12, 2012 11:25 AM” or one hour ahead. Is there a way to force day light savings time? Thanks in advance!

EDIT:
I noticed that it is actually formatting the month incorrectly. It is taking April and making it January for some reason. Why would this be?

  • 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-02T00:32:21+00:00Added an answer on June 2, 2026 at 12:32 am

    When it prints this date it prints out “Thu Jan 12, 2012 10:25 AM” which for “America/New_York” time zone, which is where I am, that is wrong.

    Nope. Daylight savings time doesn’t start until March, so it would be wrong to apply it for that time. NSDateFormatter is doing the right thing here.

    If you want to force a specific GMT offset, you should use NSTimeZone timeZoneForSecondsFromGMT: instead of localTimeZone.

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

Sidebar

Related Questions

I'm using the NSDateFormatter to get a string representing the date from my NSDate:
I'm trying to convert a string from a Twitter API result into an NSDate
How to convert that string: 2011-08-24T14:06:10Z to NSDate using NSDateFormatter. I don´t know which
i have a function to convert into NSDate by using NSDateFormatter . +(NSDate*)getDateFromCurrentTimestamp:(NSString*)currentTimestamp{ //
I have a UIDatePicker and I get the date using this: NSDate *pickerDate =
I am facing issue with proper date retrieval using date formatter.I have saved the
How can I parse a string that represents a date and/or time using iPhone
I am trying to convert string into NSDate using following code. NSString *old =
I'm able to get today's date using the following in Objective-c: NSDate *date =[NSDate
I am doing an application where I am using the following link http://iosdevelopertips.com/cocoa/date-formatters-examples-take-3.html to

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.