android - Converting String to SimpleDateFormat incorrect result -
can guys advice why have incorrect result on end on method?
public static string convertdatestringtohumanreadable(string datetoconvert) { // datetoconvert 1981-03-17t00:00:00 string date_format_pattern_input = "yyyy-mm-dd't'hh:mm:ss"; string date_format_pattern_output = "dd-mm-yyyy"; simpledateformat inputdate = new simpledateformat(date_format_pattern_input); date datetoparse = inputdate.parse(datetoconvert, new parseposition(0)); // datetoparse.tostring() sat jan 17 00:00:00 eet 1981 // why jan, i'm expecting march simpledateformat outputdate = new simpledateformat(date_format_pattern_output); return outputdate.format(datetoparse); }
use mm
instead of mm
string date_format_pattern_input = "yyyy-mm-dd't'hh:mm:ss"; string date_format_pattern_output = "dd-mm-yyyy";
Comments
Post a Comment