Here the below gettimeFormat() method is taken no of seconds as input and retuns "HH:mm:ss" As Output
public String gettimeFormat(int noofseconds) {
TimeZone timeZone = TimeZone.getTimeZone("UTC");
SimpleDateFormat sdateFormat = new SimpleDateFormat("HH:mm:ss");
sdateFormat.setTimeZone(timeZone);
String formatedTime = sdateFormat.format(new Date(noofseconds));
return formatedTime;
}
public String gettimeFormat(int noofseconds) {
TimeZone timeZone = TimeZone.getTimeZone("UTC");
SimpleDateFormat sdateFormat = new SimpleDateFormat("HH:mm:ss");
sdateFormat.setTimeZone(timeZone);
String formatedTime = sdateFormat.format(new Date(noofseconds));
return formatedTime;
}
No comments:
Post a Comment