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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:36:59+00:00 2026-06-15T16:36:59+00:00

This code. NSDate *today = [NSDate date]; NSArray *langs = [NSLocale preferredLanguages]; NSString *langID

  • 0

This code.

NSDate *today = [NSDate date];  
NSArray *langs = [NSLocale preferredLanguages];
NSString *langID = [langs objectAtIndex:0];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:langID];
*format = [[NSDateFormatter alloc] init];
[format setLocale:locale];
[format setDateFormat:@"yyyy/MM/dd HH:mm:ss"];
strTime = [[NSString alloc] initWithFormat:@"%@",[format stringFromDate:today]]; 

today is +0000.    
langID is en.    
but,strTime is Japan time.    

Why?
I want to show date and time according to the language settings.

  • 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-15T16:37:00+00:00Added an answer on June 15, 2026 at 4:37 pm

    Instead of

    NSArray *langs = [NSLocale preferredLanguages];
    NSString *langID = [langs objectAtIndex:0];
    NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:langID];
    

    Try this,

    NSLocale *locale = [NSLocale currentLocale];
    

    That should help.

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

Sidebar

Related Questions

I have a problem with this code: NSDate *today = [[NSDate alloc] init]; if
I am using this code NSDate *today = [NSDate date]; NSLog(@%@,today); In console it
I have this code NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@yyyy-mm-dd'T'HH:mm:ss.SSSSS]; NSDate *date
Initially I thought that using this code + (NSString *)getDayOfTheWeek:(NSDate *)date format:(NSString*)format { NSDateFormatter
I'm having an issue with this code: + (NSDate *)dateByMovingToBeginningOfDay:(NSDate *)date { unsigned int
I am trying to do is to get NSDate today, yesterday, this Week, last
I have the following code: NSDate *dateNow = [[NSDate alloc] init]; NSTimeInterval timeDifference =
I use this code to create and run the timer, which works OK. NSDate
NSDate *date_of_purchase; sqlite3_bind_text(addStmt, 5, [date_of_purchase UTF8String], -1, SQLITE_TRANSIENT); When I run this code, the
I have this code to get the local date/time. It works but it seems

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.