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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:42:56+00:00 2026-06-08T18:42:56+00:00

how can I program a code, which counts every X-day. Like count every monday

  • 0

how can I program a code, which counts every X-day. Like count every monday (or thursday, or whatever) from one NSDate to another (today).
I know, how to get the day of an NSDate by checking

    $int weekday = [[NSCalendar currentCalendar]components:NSWeekdayCalendarUnit fromDate:myDate]weekday];

but this isn’t helping a bit…

(Of course, I could just calculate all days and / 7, but this isn’t working for my project I’m working on…)

  • 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-08T18:42:57+00:00Added an answer on June 8, 2026 at 6:42 pm

    Run a while loop starting at the first NSDate and ending at the last NSDate. Increment by one day each time and check whether the day is equal to the day you want.

    int counter = 0;
    while ([NSDate laterDate:earlyDate:lateDate] == lateDate)
    {
         int weekday = [[NSCalendar currentCalendar]components:NSWeekdayCalendarUnit fromDate:earlyDate]weekday];
         if (weekday == desiredWeekday) counter++;
         earlyDate = [earlyDate dateByAddingTimeInterval:3600*24];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a program in java which can count number of
Is there any program code that can help me to pop up the virtual
Essentially, I'm looking for a 1D bar-code scanner that I can program, either through
Can I combine code that uses System.Drawing.Bitmap together with other code in a program
How can I see the assembly code for a C++ program? What are the
How can I prevent the following code crashing my program? ::MessageBox(NULL, Lbefore, NULL, MB_OK);
I can get my page's html code during my program and what I want
User Defined Function (UDFs) are functions that one can program and can be dynamically
The program can read all the data from the pipe. However, the program just
I want to design a c# program which can run program a 3rd exe

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.