Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2014
    Rep Power

    Default calculating years between two dates

    hi everyone, im very new to java and i am having a lot of trouble with this.
    write a program that reads in the year, month, and day of a couple's wedding date and compute thier next wedding anniversary after March 2, 2011.
    TThis has to be input in a message dialog box also.
    if someone could show me how to do this step by step that would be amazing.
    thank you

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Rep Power

    Default Re: calculating years between two dates

    Create a Calendar, set the Date of the Calendar using the information requested. Then set the year to 2011 (unless the year is already later than that), then compare that Date (see the API for a Calendar method to get the resulting Date) with a Date for March 2, 2011 and if it is before that, then add another year.

Similar Threads

  1. Integer Dates to String Dates Problem
    By HelpingIsCaring in forum New To Java
    Replies: 32
    Last Post: 08-23-2013, 12:29 AM
  2. Replies: 1
    Last Post: 06-02-2012, 04:57 AM
  3. UTC Dates
    By PedroCosta in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2010, 06:08 PM
  4. calculating with dates
    By hannes in forum New To Java
    Replies: 1
    Last Post: 01-14-2010, 08:22 PM
  5. Replies: 23
    Last Post: 02-19-2009, 05:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts