this question has answer here:
- converting date format 5 answers
i have situation can date 9/2/2016. this, need parse , create pattern m/d/yyyy. can convert input date above pattern m/d/yyyy.
is there utility/api in java.?
for requirement, first parse input string appropriate format. format date. more info refer simpledateformat
simpledateformat dateformat = new simpledateformat("m/d/yyyy"); date mydate = dateformat.parse("9/2/2016"); simpledateformat dateformat2 = new simpledateformat("mm/dd/yyyy"); system.out.println(dateformat2.format(mydate));
output
09/02/2016
Comments
Post a Comment