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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:20:39+00:00 2026-06-10T13:20:39+00:00

If I send the method dateByAddingTimeInterval: to NSDate, like below: NSDate *today = [NSDate

  • 0

If I send the method dateByAddingTimeInterval: to NSDate, like below:

NSDate *today = [NSDate date]; 
NSDate *tomorrow = [now dateByAddingTimeInterval:24.0];
NSDate *yesterday = [now dateByAddingTimeInterval:-24.0];

NSArray *dates = [NSArray arrayWithObjects: today, tomorrow, yesterday, nil];

NSLog(@"today's date is %@", [dates objectAtIndex:0]);
NSLog(@"yesterday's date was %@", [dates objectAtIndex:2]);

I get this output:

...The first date is 2012-08-30 02:14:19 +0000
...The third date is 2012-08-30 02:13:55 +0000

Which is strange because the third date should have been 2012-08-29

But… if I change the NSDate messages to:

NSDate *today = [NSDate date];
NSDate *tomorrow = [now dateByAddingTimeInterval:24.0 * 60.0 * 60.0];
NSDate *yesterday = [now dateByAddingTimeInterval:-24.0 * 60.0 * 60.0];

Why does adding the * 60.0…

...The first date is 2012-08-30 02:15:25 +0000
...The third date is 2012-08-29 02:15:25 +0000

make the output correct?

Thank you.

  • 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-10T13:20:40+00:00Added an answer on June 10, 2026 at 1:20 pm

    NSDate compute time by second.

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

Sidebar

Related Questions

I need to send GET Request method with the below headers . I am
I Send Iqueryable to a function that is below void Method<T>(ref IQueryable<T> qu) {
I've written a Connect middleware where I'd like to re-use the send method of
I'm getting an exception randomly with the Send method shown below. The exception I'm
Other than self.class.send :method, args... , of course. I'd like to make a rather
Could someone please help me to understand what the 'send()' method listed below is
Why does socket_base not have a send() method? Basically, I would like to use
I upload a file using adobe air HTTPService.Send method by passing byte array of
Usually, we only put the data we want to send as websocket.send() method's parameter,
I'm coding a simple little class with a single method send an email. My

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.