Am using DateTime from Jodatime to know , the current date is greater or lesser than given date. given date is:
12/31/2011 12:00:00 AM
my code is:
SimpleDateFormat form = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss aa");
java.util.Date date = null;
Date date1 = form.parse(mydate);
int year=date1.getHours();
int month=date1.getMonth();
day=date1.getDate();
int minute=date1.getMinutes();
int seco=date1.getSeconds();
int hour=date1.getHours();
DateTime myBirthDate = new DateTime(year,month, day, hour, minute,seco);
DateTime now = new DateTime();
myBirthDate.isAfterNow();
its returning false
and when i pass date: 4/13/2011 12:00:00 AM
same false is returning
How to do it?
Thanks
This looks wrong:
Also you can shorten your code like this: