Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
sounds like homework to me, r u sure you're a senior software engineer ?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
what prevented you from using a Date or Calender API if you are doing a project?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
    Bookmark Topic Watch Topic
  • New Topic