the every first row compared and print the value ex. 43311, but i am not able to get the sec out of it like

m.add((totalTimeInMillis < 80) ? (int) totalTimeInMillis : (int) (totalTimeInMillis % 60));
the above code is not compare the value and print out of it ?

06-05-2010, 12:43 PM

Eranga

Can you explain your question more clearly? What conversion you want to do?

06-05-2010, 01:18 PM

JosAH

Quote:

Originally Posted by Eranga

Can you explain your question more clearly? What conversion you want to do?

I don't understand the question either: we're looking at a bunch of code; some output (supposedly generated by that program) and a question about second ... If people want help they should help the people willing to help by asking a clear question.

from to
2010-06-01 09:36:13 2010-06-01 09:39:45-->take the total time (output)
2010-06-01 17:05:27 2010-06-01 17:08:28-->take the total time(output)
2010-06-01 17:10:29 2010-06-01 17:13:29-->take the total time(output)

example
2010-06-01 17:08:28-end time
2010-06-01 17:10:29-start time

please help me how to write the java code to get the above output

06-07-2010, 02:34 PM

Norm

Quote:

when the minutes above 1 take the time diff

Not sure what you are asking for.

Quote:

i need output
Code:
from to
2010-06-01 09:36:13 2010-06-01 09:39:45-->take the time diff (output)

What do ask here?
Are you asking to take the two time stamps shown above and compute the difference in some units of time.
For the times shown above, would 32 seconds be the time diff that you want?

From To
2010-06-01 09:36:13 2010-06-01 09:39:45-->take the total time(output)
2010-06-01 17:05:27 2010-06-01 17:08:28-->take the total time(output)
2010-06-01 17:10:29 2010-06-01 17:13:29-->take the total time(output)

the above output fromtime is the starting time and totime is the endtime

i do want to calculate the time diff between 2010-06-01 09:39:45 to 2010-06-01 17:05:27 please see the above need output with database result.

06-08-2010, 10:31 AM

Tolls

But how do you determine the cutoff point for the calulcation?

Why 09:36:13 to 09:39:45 and not 09:36:13 to 17:07:28?

How do you determine the cutoff?

In any case, parse them to a Date (SimpleDateFormat) and subtract one from the other to get milliseconds.

06-08-2010, 11:07 AM

baktha.thalapathy

how to subtract one from the other to get milliseconds

please provide any sample code

06-08-2010, 11:14 AM

Tolls

You can do maths can't you?
What do you think you need to do?

If you can't do this then maybe you shouldn't be doing software?

06-08-2010, 06:13 PM

Norm

For each time:
Create a SimpleDateFormat object.
Use the getCalendar() method to get a Calendar() object
Use the getTimeInMillis() to get the milliseconds value.

Subtract one from the other to get the difference.

06-08-2010, 06:16 PM

Tolls

Why go through all that?
Simply parse() with the SimpleDateFormat, then use getTime() on the returned Date object to get the time in millis. There's no need whatsoever to go through a Calendar.

06-09-2010, 04:24 AM

Eranga

Quote:

Originally Posted by JosAH

I don't understand the question either: we're looking at a bunch of code; some output (supposedly generated by that program) and a question about second ... If people want help they should help the people willing to help by asking a clear question.

kind regards,

Jos

Yes it is. I think that's because most of them believe that whoever looking into the thread will fix all stuff there.