English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hi, i'v got two times and i want to caculate the differernce between them. they are both Strings so will i have to convert them into milliseconds first or is there a way to do the calculation directly?

2006-08-14 05:17:05 · 3 answers · asked by sammyboywonder 2 in Computers & Internet Programming & Design

3 answers

Here I was thinking that you were asking about two different times on the island of Java, in the Republic of Indonesia. Based on a time zone map, the entire island is in the same time zone, same as Christmas Island, Vietnam, Laos, Cambodia, and Thailand.
http://upload.wikimedia.org/wikipedia/commons/3/3d/Timezones_optimized.png

But based on your further description, it seems that you are calculating times within the java computer programming language. That's completely different... I'd probably start with the Java tutorials: http://java.sun.com/

2006-08-14 05:40:44 · answer #1 · answered by mrvadeboncoeur 7 · 0 0

It might not be easiest way, but I'd splint the Strings into integers, create GregorianCalendar objects, convert to longs (milliseconds), and then subtract. Then you've got a bunch of % operations to get back into sensible times.

2006-08-14 13:03:54 · answer #2 · answered by Dr.Mr.Ed 5 · 0 0

First you have to do parseInt to get it into an integer and then do the calculation. You can never do a calculation when the number is stored as a string.

2006-08-14 12:41:26 · answer #3 · answered by flit 4 · 0 0

fedest.com, questions and answers