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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:59:41+00:00 2026-05-25T00:59:41+00:00

Please help me with the following code. All I want to do is see

  • 0

Please help me with the following code. All I want to do is see the time (4:42:55) between two dates that are less than 24 hours different, so I don’t care about the days.

Thanks

NSLog(@"error code");
NSDate *now = [[NSDate alloc] init];
NSDate *time = [[NSDate date] dateFromString:@"6:23 PM"];
NSTimeInterval secs = [now timeIntervalSinceDate:time];
NSLog(@"end error code");

int hours = floor((int)secs /  (60 * 60) );        
float minute_divisor = (int)secs % (60 * 60);
int minutes = floor(minute_divisor / 60);
float seconds_divisor = (int)secs % 60;
secs = ceil(seconds_divisor);
NSString *msg = [NSString stringWithFormat: @"%@:%@:%@", hours, minutes, (int)secs];

Here is there Log

2011-08-24 22:17:34.827 App[31814:f503] error code
2011-08-24 22:17:34.827 App[31814:f503] -[__NSDate dateFromString:]: unrecognized selector sent to instance 0x6e23d30
2011-08-24 22:17:34.828 App[31814:f503] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDate dateFromString:]: unrecognized selector sent to instance 0x6e23d30'
*** First throw call stack:
(0x1664082 0x17f5d0a 0x1665d1d 0x15caf70 0x15cad52 0x4998 0x392a 0xdef05 0x3f8d3 0x3fb27 0x3fc82 0xc94ec46 0x46b7a 0x23ae 0x179a0 0x18870 0x275f3 0x280a8 0x1ba29 0x130a10d 0x16381f5 0x159d0a2 0x159b98a 0x159ae34 0x159ad4b 0x18271 0x19a1b 0x1ff8 0x1f55)
terminate called throwing an exception
  • 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-25T00:59:42+00:00Added an answer on May 25, 2026 at 12:59 am

    dateWithString: is a class method:

    [NSDate dateWithString:...]
    

    However, NSDate on iOS doesn’t have this method. You’ll have to use an NSDateFormatter with the -dateFromString: method.

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

Sidebar

Related Questions

Please can someone help? I have the following code which uploads a file to
Can someone please help me figure out a way to achieve the following (see
Please, help minimize the following code: There is a class with dictionary property: class
all! I want to create multiple threads in my application. I' using following code
All you ios architects out there, please help me choose architecture/technology for the following
I am newbie on the Linux signals, please help. The following code get core
All, I have the following code: echo '<a href=register>Please try again</a>'; I'm using Wordpress
I want to get class methods in an object. Please see the following example
Please help regarding the following issue. I have enabled the Block popup option in
Please help I am getting the following error when I am binding the drop

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.