File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Eval a time of day using equals() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Eval a time of day using equals()" Watch "Eval a time of day using equals()" New topic
Author

Eval a time of day using equals()

Reggie McDougal
Ranch Hand

Joined: Sep 27, 2004
Posts: 69
Can some one give me a hand with my code the below always returns false when the strings currentTime and RUNTIME are equal.




Can some one give me a hand
[ December 05, 2004: Message edited by: Reggie McDougal ]

You can never drink too much
Sainath Veepuri
Ranch Hand

Joined: Sep 25, 2003
Posts: 49
Hi Reggie,

Originally posted by Reggie McDougal:
Can some one give me a hand with my code the below always returns false when the strings currentTime and RUNTIME are equal.






If it is the 5th minute in that hour then c.get(Calendar.MINUTE)is returning 5 instead of 05, hence it always would return false.
Just remove '0' from '05' and check it accordingly. It works fine!
rastas biggs
Ranch Hand

Joined: Sep 24, 2004
Posts: 41
But it was doing it on 7:22:00 as well which tells me that its not evaluating
Sainath Veepuri
Ranch Hand

Joined: Sep 25, 2003
Posts: 49
Hi,
I answered according to the data in your question.
Any ways, it would only return false if the two strings are not equal.
So why don't you print the two strings and check if they are really equal or not.

- Sai
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Eval a time of day using equals()
 
Similar Threads
Issues with fetching Year and Month from the Calender
5 minutes Time increments
48 hours rule, pls recomment
gps week/seconds conversion
Time Difference