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

    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
    Jdc

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    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, 01:29 AM
  2. Replies: 1
    Last Post: 06-02-2012, 05:57 AM
  3. UTC Dates
    By PedroCosta in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2010, 07:08 PM
  4. calculating with dates
    By hannes in forum New To Java
    Replies: 1
    Last Post: 01-14-2010, 09:22 PM
  5. Replies: 23
    Last Post: 02-19-2009, 06: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
  •