between 2 dates

does anyone know how to search and display the total between 2 days without using lots of code
maybe this is what you are looking for...
http://www.cplusplus.com/reference/ctime/difftime/
Determine number of seconds since 1970 for both dates
Subtract smallest from largest number
divide by /60/60/24 for # days

example to get you started

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <string>
#include <time.h>
using namespace std;

int main()
{
time (0);
cout << "Current time in Seconds from 1/1/1970 =  " << time (0)<<endl;
cout << "Current time in days from 1/1/1970    =  " << time (0)/60/60/24<<endl;

return 0;
}
Last edited on
thanks but not sure if that is what I need be able to input date 2 dates and for example 21/02 /13 and 10/03/13 then look for a match in my payslip.txt
and calculate the total wages between them . think ihave to try and convert the date in some way i know how to search one date but and keep a running total .
Topic archived. No new replies allowed.