For Programmers: Free Programming Magazines  


Home > Archive > Java Help > September 2004 > Converting Time in String form to a Long









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Converting Time in String form to a Long
Al Wilkerson

2004-09-24, 4:00 am


Hello,

Does anyone now how to access the setTimeInMillis method of the Calendar
Interface.
I have a time in the format of HH:MM:SS: which is a string, but I want to
convert it to a long, so I can compare the times to figure out of two times
how far greater or lesser one is.

Thanks,

--
Al


Al Wilkerson

2004-09-24, 4:00 am

Sorry, I meant from the the java.util.Calendar class.

Al
"Al Wilkerson" <ac527@comcast.net> wrote in message
news:u3N4d.248739$mD.117700@attbi_s02...
>
> Hello,
>
> Does anyone now how to access the setTimeInMillis method of the Calendar
> Interface.
> I have a time in the format of HH:MM:SS: which is a string, but I want to
> convert it to a long, so I can compare the times to figure out of two

times
> how far greater or lesser one is.
>
> Thanks,
>
> --
> Al
>
>



Tor Iver Wilhelmsen

2004-09-24, 4:00 am

"Al Wilkerson" <ac527@comcast.net> writes:

> I have a time in the format of HH:MM:SS: which is a string, but I want to
> convert it to a long,


Use SimpleDateFormat and do getTime() on the Date object you get when
you parse.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com