Bookmark Topic Watch Topic
  • New Topic

Program for Date Difference without using inbuilt Date or Calendar classes or methods  RSS feed

 
Sunny Nambiar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi friends,
This is the problem. I would be highly obliged if anyone could get me a sample code for this.
Regards
Sunny

Given two dates (during the years 1901 and 2999, inclusive), find the number of days between the two dates.
Input: Six sets of data. Each set has two dates in the format month, day, year. For example, the input line '6, 2, 1983, 6, 22, 1983' represents
June 2, 1983 to June 22, 1983.
Output: The number of days between the given dates, excluding the starting date and the ending date. For example, there are 19 days between June 2, 1983 and June 22, 1983; namely, June 3, 4, ..., 21.
Sample Input (3 sets):
Input Line #1: 6, 2, 1983, 6, 22, 1983
Output #1: 19
Input Line #2: 7, 4, 1984, 12, 25, 1984
Output #2: 173
Input Line #3: 1, 3, 1989, 3, 8, 1983
Output #3: 1979
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Report post to moderator
sounds like homework to me, r u sure you're a senior software engineer ?
 
parag Chatterjee
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
what prevented you from using a Date or Calender API if you are doing a project?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't repost the same question in different forums - it wastes our time to repeat answers that have already appeared elsewhere. Did you look at the response to your previous post? If you don't understand what is meant, just post your questions in the same thread that contained the original question. (The thread appears as "new" each time there's a new post.) Thanks.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!