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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:50:03+00:00 2026-06-12T06:50:03+00:00

My problem is I want to have some way to represent time (without date),

  • 0

My problem is I want to have some way to represent time (without date), like time of day in my iOS app. From a REST api I get strings like “13:12:11” which shows the time something happens, I have used NSDateFormatter to convert NSStrings to NSDates but as far as I can tell it does not accept date formats with just time components like HH:mm:ss [EDIT: you can, see below]

So my questions are
1- Is NSTimeInterval (instead of NSDate) what I should be using to store time of day?
2- How can I convert “03:04:05” to and objective-c object from one of the built in frameworks.

EDIT: You CAN use formats like “HH:mm:ss” it just replaces the date part with 2000-01-01
Still it would be very nice to have a date independent time of day representation.

  • 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-12T06:50:05+00:00Added an answer on June 12, 2026 at 6:50 am

    OK, thanks everybody, this is what I ended up doing:

    NSString * timeAsString = "12:26:07";
    NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"HH:mm:ss"];
    NSDate * dateZero = [dateFormatter dateFromString:@"00:00:00"];
    NSDate * dc = [dateFormatter dateFromString:timeAsString];
    NSTimeInterval startTime = [dc timeIntervalSinceDate:dateZero];
    

    It is not an elegant solution but it works, at least for what I need to do,

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

Sidebar

Related Questions

I have one problem , I want to get some data from XML file
I have some problem. Dialog.dismiss() does not work. I want to input ip, username,
I have some kind of problem with jQuery selectors. Let's say i want to
I want to persist my entity with ManyToMany relation. But i have some problem
my problem is: I have an image and want to mark some areas over
I have this problem: I want to generate a new source code file from
i want to use .animate function but i have some problems i want to
I got some problems in Datagrid WPF I have a datagrid, and I want
with my RCP program I have the problem that I want to have more
My problem is that I want to have a tab bar view with its

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.