I have time stamps as string format Sun Jul 10 17:47:55 EDT 2011
I need to determine if the current DAY is greater than the stored day.
I will get the current day with
Date currentDate = new Date();
and I will parse my string into a Date
object with SimpleDateFormat dateParser = new SimpleDateParser("E MMM d HH:mm:ss z y");
but using the "currentDate.after()" function, or the currentDate.compare()
function will only tell me if ANY date is greater or less than, which includes by the hour,minute or second.
So My next hunch would be to convert the date into the day of the year, and compare the new integers, if integer1>integer2, then.. but how would I do that?
I also considered breaking the string up to a substring consisting of only the first half of the stored string date. Sun Jul 10
to Sun Jul 10
but the problem here is that the day value is sometimes 1 digit and othertimes 2 digits.
Also I think the Calendar
abstract class is the best way to go about this, but I am unsure, and currently in a fog about how to convert the Date objects into the Calendar object for comparison!
Insight appreciated