Ok, I have this simple assignment that's not so GD simple since the prof hasn't taught us anything date/time related and it's not in the bookpart of the program involves the user entering a start time and finish time - how would you go about finding the difference between the two if they were given in military time?and to keep it simple there would be no : - so it'd be 830 and 1330 for example[Edited on October 2, 2005 at 11:49 PM. Reason : ]
10/2/2005 11:48:13 PM
perhaps i'm misunderstanding "finding the difference", but if it was military time wouldn't you just subtract 1 from the other. I would imagine you could compare to see which is bigger and then take the smaller and subtract to find the difference. Sorry if my assumptions of miltime are incorrect.
10/2/2005 11:53:37 PM
military time still has 60 minutes in an hour
10/2/2005 11:56:22 PM
look up the class
java.lang.System
10/2/2005 11:58:02 PM
http://java.sun.com/j2se/1.3/docs/api/java/util/Date.html
10/3/2005 12:12:11 AM
yea, i'm gonna go ahead and say i'm a java n00b and none of that is helping
10/3/2005 12:21:31 AM
I'm reluctant to give help considering that's for a class.But I can see a very easy way to do this that doesn't involve any special classes in Java.
10/3/2005 12:26:10 AM
....[Edited on October 3, 2005 at 12:27 AM. Reason : ]
10/3/2005 12:27:00 AM
[Edited on October 3, 2005 at 12:35 AM. Reason : crap this is for a class]
10/3/2005 12:34:23 AM
^ lol - DaveOT gave me a good idea, though.thanks guys
10/3/2005 12:41:39 AM
yeah man. I would help but I ain't trying to talk with Paul Cousins in my final semester. after Dec 15, I won't care but for now gotta cover my tail
10/3/2005 1:22:42 AM
haha, i don't blame you - i don't want it to be just given to me either, though, but thanks ps - i'm not at state anyway
10/3/2005 1:35:20 AM
use metric time.
10/3/2005 10:10:17 AM
ok, so i know how i can find the difference in times one daybut....with what we've been taught i have no idea how to seperate the parts of the time....like, if the input is 0830, using the scanner class that we've been using i haven't the slightest how to split that into 08 and 30 but i think i just figured out another way - fuck the teacher[Edited on October 3, 2005 at 2:23 PM. Reason : ]
10/3/2005 2:17:09 PM
int five = "2345x6y".charAt(3) - '0';
10/3/2005 2:24:38 PM
done - took all of 3 minutesi'm stupid[Edited on October 3, 2005 at 3:47 PM. Reason : ]
10/3/2005 3:47:25 PM
remember how division works with int's... 2465/100 = 24 and 2465%100 = 65. I'll leave it at that.
10/3/2005 3:55:10 PM
thanks again for the ideas guys
10/3/2005 7:59:59 PM