//It'll work upto three decimal places when converted from long to double //Here, 'time' is a variable converted from long to double double dble = Double.valueOf(String.format(Locale.ENGLISH, "%1$.3f", time/3600.000));