Solved

Calculate days between two dates

Posted on 1997-03-06
1
232 Views
Last Modified: 2010-04-10
I want to calculate the number of days between two days.
0
Comment
Question by:manne
1 Comment
 
LVL 1

Accepted Solution

by:
vanbasco earned 100 total points
Comment Utility
Well, I suggest you introduce a table containing the number of days for each month, for example days_in_this_month[];

For example, number of days (including both start and end-day) from January 13 to March 7:

int day_number = 0;

for (i=1; i<3;i++)
  day_number += days_in_this_month[i];

day_number -= (13-1);
day_number += 7;

//Hope this helps.
 
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now