wood burning stoves 2.0*
The moose likes Java in General and the fly likes To check the input date is future date or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "To check the input date is future date or not" Watch "To check the input date is future date or not" New topic
Author

To check the input date is future date or not

Shein Zeya
Greenhorn

Joined: Jun 04, 2008
Posts: 10
I'm now trying to check an input date is valid or not:that is DOB,
if the date is the future date,it cannot be DOb and so alert that the Date is invalid.
if not....accept it.
So......first..I have to change the incoming date form to my fixed date form.Then compare it.
I know the concept ,but I just want to get tge reference.
Thank you.
Pls help.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3429
    
  12
Use the SimpleDateFormatclass to convert your input date to a Dateobject. Create another Date object tio represent the current time and then use methods in the Date class to compare them.
[ June 05, 2008: Message edited by: Joanne Neal ]

Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38007
    
  22
The Calendar class implements the Comparable<Calendar> interface, so you can compare your date with what the Calendar class API calls "rightNow." If you get a value >0 you are onto a winner!
 
 
subject: To check the input date is future date or not
 
Similar Threads
Date validation
WA #1.....word association
date
Check if DOB entered as a string is valid
select statement