Search code examples
androidparsingtimepicker

How can i get the time of a TimePicker in this format -> "08:00:00"?


i have a android timepicker, and i need to get his time in java code, and transform it into a string with this appereance: "08:00:00" (hours, mins, secs)

can someone help me to do it in a easy way?

code example will be appreciated


Solution

  • SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
    String formatted = format.format(date); // date is a long in milliseconds