java - GetTime doesn't correctly display zero's -


i use timestamps in system. works correctly, find annoying have [12:2:2] timestamp. because don't know if it's 20 or 2.

i tired , sick, , starting think compiler.

    java.util.date date= new java.util.date();     timestamp time = new timestamp(date.gettime());     super.print("[" + time.gethours() + ":" + time.getminutes() + ":" + time.getseconds() + "] ");re 

how guys correct timestamps zero's?

have @ dateformat or simpledateformat class.

simpledateformat df = new simpledateformat("hh:mm:ss"); df.format(new date()); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -