date - SimpleDateFormat parsing in Android -
i trying parse date time string date object. however, keep getting wrong date dont know why. can me?
my code looks this:
simpledateformat dateformat = new simpledateformat("dd.mm.yy-hh:mm"); string test = serverentry.getstring("date") + "-" + serverentry.getstring("time"); string test2 = dateformat.parse(test).tostring();
an example run has these outputs:
test = "27.06.14-12:18" // in 27th of june 2014, 12.18 (24-hours) test2 = "sat jun 27 12:06:00 cest 2015"
mm
specifies month of year , mm
specifies minutes. need instead:
simpledateformat dateformat = new simpledateformat("dd.mm.yy-hh:mm");
reference: http://developer.android.com/reference/java/text/simpledateformat.html
Comments
Post a Comment