java - Date conversion Simple Date format -
i need convert date format yyyy.mm.dd , using below formula -
date curdate = new date(); out.println(curdate); string pattern = "yyyy.mm.dd"; dateformat format1 = new simpledateformat(pattern, locale.english); string datetostr = format1.format(curdate); out.println(datetostr);
the output getting
curdate - fri feb 05 15:21:28 cst 2016 datetostr - 2016.21.05
i need instead of 2016.21.05, should datetostr - 2016.02.05.
any doing wrong here?
thanks, arun
what want yyyy.mm.dd
= year.month.day, while yyyy.mm.dd
= year.minute.day.
see cheat sheet more info.
Comments
Post a Comment