How do i subtract dates?? See i would like to do it for an employees contact. If the contract expires dat is in the program makes a calculation to take awat the expiry date from the current date and says how long is left. How do i do that?
1. create 2 date objects a current date and a contract expiration one.
2. get time in milli seconds from both date objects
4. and convert the remainder to days, months and years etc
read documentation on java.util.Date and java.util.Calendar
ok so. this is what i want to do:
u type in the contract expire date in a textfield.
then i want to be able to subtract that from the current date and show that answer .
get the user input from textfield
then convert that to a date by using SimpleDateFormat
now follow the steps in my previous response
wat u mean by simpledateformat? How do u convert it like that?
Do u have an example?
Contract expiry Date: 05/05/07
How do i get contract left?
Calendar endTime = Calendar.getInstance();
// Difference of Time in Minutes AND Conversion Milli-Seconds to Minutes
int diffMins = (int) (( endTime.getTimeInMillis() -
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)