How to convert a time whch given in string and find the difference in java and convert back to string -
this question has answer here:
i have following time given day in sting format.
"begin_time_tz": "00:00 dst", "end_time_tz": "07:30 dst",
i have find difference between them in java. please me find difference , convert string
note: date in 24 hour format(00:00 -- 23:59)
you can use below method time difference, pass hh:mm without timezone.
public long gettimedifference(string time1, string time2) throws parseexception{ simpledateformat format = new simpledateformat("hh:mm"); date date1 = format.parse(time1); date date2 = format.parse(time2); long difference = date2.gettime() - date1.gettime(); return difference/1000; }
Comments
Post a Comment