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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:29:32+00:00 2026-05-24T06:29:32+00:00

The result is still a day before, I’m just asking myself why, because the

  • 0

The result is still a day before, I’m just asking myself why, because the NSTimeZone is properly set and is the right one for my country (italy, rome)
here’s my stub of code, any ideas?

    NSString *dateString = @"03/07/2008";
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setFormatterBehavior:[NSDateFormatter defaultFormatterBehavior]];
    [formatter setDateFormat:@"dd/MM/yyyy"];
    [formatter setLocale:[NSLocale currentLocale]];
    [formatter setTimeZone:[NSTimeZone systemTimeZone]];
    NSDate *dateFromString = [formatter dateFromString:dateString];
    [formatter release];

the result in dateFromString is this 2008-07-02 22:00:00 +0000.

I’ve looked for other solutions but the common answer was to set the timezone correctly, in my case it is set properly but the problem still remains.

  • 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-24T06:29:33+00:00Added an answer on May 24, 2026 at 6:29 am

    That is correct because by default the NSDate will return a UTC date in its description +0000. You are a couple of hours ahead of UTC so you get 22:00:00 for the day prior. I am -5 and my result UTC is 2008-07-03 04:00:00 +0000 (DST). The date is correct, it is just being displayed in UTC, if you are trying to display it correctly somewhere just use the date formatter to get a string again.

    ...
    NSDate *dateFromString = [formatter dateFromString:dateString];
    NSString *stringFromDate = [formatter stringFromDate:dateFromString];
    [formatter release];
    
    NSLog(@"%@ : %@", dateFromString, stringFromDate);
    

    2008-07-03 04:00:00 +0000 : 03/07/2008

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

Sidebar

Related Questions

Good day... Still a beginner question. I mostly asking to save myself hours of
I spent a whole day on something so trivial as this one, still can't
In C and C++, Freeing a NULL pointer will result in nothing done. Still,
What result is right for the following test cases? //Chrome 19 Opera 12 Firefox
I'm stuck on this and have been all day.. I'm still pretty new to
I just want to add 1 day to a DateTime . So I wrote:
Good day! I am wondering how can I get the desired result in my
Good day. The one thing I now hate about Haskell is quantity of packages
How do I properly group an array: (end result) Array ( [0] => Array
I am a bit puzzled with my Regex results (and still trying to get

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.