Results 1 to 2 of 2
- 02-24-2014, 03:15 AM #1
Member
- Join Date
- Feb 2014
- Posts
- 1
- Rep Power
- 0
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
- 02-24-2014, 08:19 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,571
- Rep Power
- 12
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
-
Integer Dates to String Dates Problem
By HelpingIsCaring in forum New To JavaReplies: 32Last Post: 08-23-2013, 12:29 AM -
calculating number of days between 2 dates chosen in jdateChooser
By zahidawi in forum New To JavaReplies: 1Last Post: 06-02-2012, 04:57 AM -
UTC Dates
By PedroCosta in forum Advanced JavaReplies: 3Last Post: 04-01-2010, 06:08 PM -
calculating with dates
By hannes in forum New To JavaReplies: 1Last Post: 01-14-2010, 08:22 PM -
[Very Urgent] Need help calculating difference between two dates
By rustix in forum Advanced JavaReplies: 23Last Post: 02-19-2009, 05:24 AM
Bookmarks