java - How can i format a decimal value into hours and minutes? -


for example if user input 1.71 (1 hour , 71 minutes), want convert 2.11 (2 hours , 11 minutes)

decimalformat time = new decimalformat("##.## p.m");  int userinput = 1.71;  system.out.print(time.format(userinput)); 

parse input date , format date output format:

  scanner sc = new scanner(system.in);   dateformat df = new simpledateformat("hh.mm");   dateformat dfout = new simpledateformat("h.mm a");   date date  = df.parse(sc.next());   system.out.println(dfout.format(date)); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -