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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:17:15+00:00 2026-06-16T00:17:15+00:00

Given a date in NSString like 2012-12-17 04:36:25 (which is GMT) how one can

  • 0

Given a date in NSString like “2012-12-17 04:36:25” (which is GMT) how one can simply change it to other time zones like EST, CST

All the steps I saw so far took so many unnecessary steps

  • 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-16T00:17:16+00:00Added an answer on June 16, 2026 at 12:17 am
    NSString *str = @"2012-12-17 04:36:25";
    NSDateFormatter* gmtDf = [[[NSDateFormatter alloc] init] autorelease];
    [gmtDf setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
    [gmtDf setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate* gmtDate = [gmtDf dateFromString:str];
    NSLog(@"%@",gmtDate);
    
    NSDateFormatter* estDf = [[[NSDateFormatter alloc] init] autorelease];
    [estDf setTimeZone:[NSTimeZone timeZoneWithName:@"EST"]];
    [estDf setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate *estDate = [estDf dateFromString:[gmtDf stringFromDate:gmtDate]]; // you can also use str
    NSLog(@"%@",estDate);
    

    Edit : Adding swift code

    let str: String = "2012-12-17 04:36:25"
    let gmtDf: NSDateFormatter = NSDateFormatter()
    gmtDf.timeZone = NSTimeZone(name: "GMT")
    gmtDf.dateFormat = "yyyy-MM-dd HH:mm:ss"
    let gmtDate: NSDate = gmtDf.dateFromString(str)!
    print(gmtDate)
    let estDf: NSDateFormatter = NSDateFormatter()
    estDf.timeZone = NSTimeZone(name: "EST")
    estDf.dateFormat = "yyyy-MM-dd HH:mm:ss"
    let estDate: NSDate = estDf.dateFromString(gmtDf.stringFromDate(gmtDate))!
    print(estDate)
    

    Edit: Adding Swift 3 code

        let str: String = "2012-12-17 04:36:25"
        let gmtDf = DateFormatter()
        gmtDf.timeZone = TimeZone(identifier: "GMT")
        gmtDf.dateFormat = "yyyy-MM-dd HH:mm:ss"
        let gmtDate = gmtDf.date(from: str)!
        print(gmtDate)
    
        let estDf = DateFormatter()
        estDf.timeZone = TimeZone(identifier: "EST")
        estDf.dateFormat = "yyyy-MM-dd HH:mm:ss"
        let estDate = estDf.date(from: gmtDf.string(from: gmtDate))!
        print(estDate)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an events object which is given below NSString *name; NSString *date; NSInteger
I'm trying to calculate time blocks from given date range. Here's my attempt: <?php
how does one calculate the beginning of a week from a given date e.g
In PHP, you can tell if a given date is during the Daylight Savings
I have given date strings like these: Mon Jun 28 10:51:07 2010 Fri Jun
the server gives the UTC formatted date and time. 2012-11-28T10:32:15+01:00 the utc will be
If I was to given a specific java.util.Date, how can I generate a start
How can I get the ISO-8601 week number of a given date in Crystal
I have some code which works out the time from today until a given
For a given date in the past, and assuming a US timezone, how can

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.