android - Passing always two characters to string from an int value -
This is the piece of code I'm using to remove:
- the day of the week
of the month
of the month
years
hours
-minutes P> From a string
// calculo de fechas string fecha = resultp.get (Agenda_MainActivity.DIA); // format & gt; 2014-04-21 String Time = resultp.get (Agenda_MainActivity .HORA); // format - & gt; 17:30:00 string string = fade + "" + time; Calendar calendar = calendar.justinstance (); Try {calendar.setTime (New SimpleDateform ("yyyy-MM-d: m: s"). Pars (string)); } Grip (ParseException E) {// TODO self generated blocking block e.printStackTrace (); } All are working fine The only issue I have been doing is counting the minutes. This is the code that I use to remove minutes:
string mintos = string.value (calendar.Ast (calendar.minutee)); The problem is the following, if the time is 17:35, then mintos = "35", as it should be. But the time is like 17:00, then miniatus = "0", and not "00".
I need your help to solve this small problem. Thank you.
string min; String Minutes = String.whouf (calendar.gate (calendar.minenti)); If (Integer.parseInt (Minutos) & lt; 10) {min = "0" + String.valueOf (Minutos)} else {min = Minutos}
Comments
Post a Comment