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 6328547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:28:37+00:00 2026-05-24T17:28:37+00:00

I am getting a NSDate *newDate value as 2011-08-12 13:00:00 +0000 . Now when

  • 0

I am getting a NSDate *newDate value as 2011-08-12 13:00:00 +0000.
Now when I try to convert it to a string by dateformatter as follows:

NSDateFormatter *dateFormatter= [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd h:mm:ss Z"];

NSString *datestr = [[dateFormatter stringFromDate:newDate] lowercaseString]; 

But the value which I get for datestr is 5:30 hours more than the newDate value. I don’t know where I am wrong. I get value for datestr as 2011-08-12 18:30:00 + 5:30 (which is incorrect).

  • 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-05-24T17:28:38+00:00Added an answer on May 24, 2026 at 5:28 pm

    It is basically converting the time to your local time zone. if you dont want that just set the time aone for date formatter:

    [dateFormatter setTimeZone:[NSTimeZone <use any of the functions below to get your desired one>]];
    

    Documentation link:
    http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSTimeZone_Class/

    Creating and Initializing Time Zone Objects
    + timeZoneWithAbbreviation:
    + timeZoneWithName:
    + timeZoneWithName:data:
    + timeZoneForSecondsFromGMT:
    – initWithName:
    – initWithName:data:
    + timeZoneDataVersion
    Working with System Time Zones
    + localTimeZone
    + defaultTimeZone
    + setDefaultTimeZone:
    + resetSystemTimeZone
    + systemTimeZone
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NSDate *now = [NSDate date]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@yyyy]; NSString
I am getting date in string formate ad 2012-04-11T07:51:10+0000 & I want to convert
I have this part of code: NSDate *date =nil; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]
I am trying to convert string into NSDate using following code. NSString *old =
I have an a string in UTC which i want to convert to NSDate.
I'm getting the current date/time using [NSDate date] . The value returned is an
Getting a crash when trying to pass the string into NSDateFormatter dateFromString method. I
I am converting NSString to NSDate with help of NSDateFormatter. Now code works fine
My date string that I am getting is 8/5/2011 1:38:13 PM of this format.
Possible Duplicate: NSString to NSDate Hi I want to convert the string OCT 1,

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.