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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -