can i get a link or the code to change a user input time format to milliseconds. for example a user has put 08:00 or 20:00 (24 hour clock), i need to convert the time to Milliseconds. Thanks in advance for any help.
Moreover can i also get some hints about executing a code for a specific amount of time and after that time the application stops.for example the application runs for 1 hour and stops after 1 hour.thanks again.
[Zaafir]: can i get a link or the code to change a user input time format to milliseconds
Milliseconds since... what? The standard choice in Java (inherited from the Unix world) is to measure milliseconds since Jan 1, 1970 GMT. This is used in the java.util.Date class and associated classes like the evil Calendar and GregorianCalendar classes. Also less evil (less needlessly obfuscated) classes, like SimpleDateFormat. The last is probably what you want for parsing user input and converting it to a Date. For example:
As for how to get your code to execute for an hour... well, that depends. Does your code normally complete in less than an hour, and you're just looping repeatedly to keep it alive? Or does your code sometimes take more than an hour to complete its basic tasks, and you need to be able to kill it if it runs too long?
"I'm not back." - Bill Harding, Twister
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop