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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:57:40+00:00 2026-06-15T03:57:40+00:00

In my project, I have used NSDateFormatter to properly format the dates displayed in

  • 0

In my project, I have used NSDateFormatter to properly format the dates displayed in my application. To be more specific, here is an example:

English: 12:34 am
Arabic: ١٢:٣٤ ص

Looks great, shows the numerals that I need. However, I have a time counter/timer that is counting up/down in the app:

01:31:22 // HH:mm:ss

How would I properly localize this counter to be displayed as:

٠١:٣١:٢٢

I checked NSDateFormatter, but it doesn’t really represent this particular use case, as far as I can see. NSNumberFormatter seems to work for currencies and percentages.


Why NSDateFormatter Doesn’t Make Sense:

Because it has NSTimeZone property, and has am/pm suffix which are both useless when we want to use counters.

  • 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-15T03:57:41+00:00Added an answer on June 15, 2026 at 3:57 am

    Right then, I think I have something for you. I’ve created a basic NSFormatter subclass, which will do the trick for you. All you need to do, it provide it with an NSNumber, that contains an NSTimeInterval.

    The .h and .m are available here: https://github.com/WDUK/WDCountdownFormatter

    And here is some example code using it, and yes, it should respect locales.

    WDCountdownFormatter* format = [[WDCountdownFormatter alloc] init];
    NSLog(@"70 - %@",[format stringForObjectValue:@(70)]);
    NSLog(@"179 - %@",[format stringForObjectValue:@(179)]);
    NSLog(@"-10 - %@",[format stringForObjectValue:@(-10)]); // Invalid, will return nil
    NSLog(@"0 - %@",[format stringForObjectValue:@(0)]);
    NSLog(@"9827193 - %@",[format stringForObjectValue:@(9827193)]);
    NSLog(@"1 - %@",[format stringForObjectValue:@(1)]);
    

    Produces

    // UK English
    2012-11-28 23:11:11.453 StackOverflow[28687:c07] 70 - 00:01:10
    2012-11-28 23:11:11.456 StackOverflow[28687:c07] 179 - 00:02:59
    2012-11-28 23:11:11.457 StackOverflow[28687:c07] -10 - (null)
    2012-11-28 23:11:11.458 StackOverflow[28687:c07] 0 - 00:00:00
    2012-11-28 23:11:11.458 StackOverflow[28687:c07] 9827193 - 2729:46:33
    2012-11-28 23:11:11.459 StackOverflow[28687:c07] 1 - 00:00:01
    
    // Egyptian Arabic
    2012-11-28 22:59:54.057 StackOverflow[28400:c07] 70 - ٠٠:٠١:١٠
    2012-11-28 22:59:54.659 StackOverflow[28400:c07] 179 - ٠٠:٠٢:٥٩
    2012-11-28 22:59:55.473 StackOverflow[28400:c07] -10 - (null)
    2012-11-28 22:59:56.464 StackOverflow[28400:c07] 0 - ٠٠:٠٠:٠٠
    2012-11-28 22:59:57.311 StackOverflow[28400:c07] 9827193 - ٢٧٢٩:٤٦:٣٣
    2012-11-28 23:10:36.657 StackOverflow[28400:c07] 1 - ٠٠:٠٠:٠١
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In project I have used some 3rd party application. Now it looks it's no
I have used the Tab Bar Application in New Project in Xcode. In IB,
In my application project i have used AppDomain.CurrentDomain.BaseDirectory to get the file path. When
i need to access folder in project .I have used Directory.CurrentDirectory and it is
I have used push notification for my project & was working fine with HTTP
I have used the following template in my project: <DataTemplate x:Key=textBoxDataTemplate> <TextBox Name=textBox ToolTip={Binding
I have used java mail(com.sun.mail.smtp) from my struts project. Mail is sent successfully but
I have a large project in C++ Builder that seems to have used the
We've got into a very tricky scenario in a project. We have used lot
In the Setup Project I have 2 web.config files: web.config - used during the

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.