datetime - java: compare time/date and get the correct format of time difference -



datetime - java: compare time/date and get the correct format of time difference -

i have these 2 times

2011-9-5 0:00 2011-9-5 15:50

when there time difference

date d1=df.parse(interviewlist.get(28).gettime()); date d2=df.parse(interviewlist.get(29).gettime()); long d1ms=d1.gettime(); long d2ms=d2.gettime(); diff = math.abs((d1ms-d2ms)/60000);

it gives me right difference difference coming 950 how can in proper format 15:50 ( diff of above two)

thanks

it gives right difference,

950 min = 15 hr , 50 min

you can accomplish by

int hr = totalminutes / 60; int min = totalminutes - (hour * 60);

and then

string dispstring = hr + ":" + minute;

java datetime

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -