在对时间进行转换中,通常会把秒转换成时分秒的小功能,怎么才能做到呢,其实也简单 这就涉及到时分秒之间的相互转换
具体代码如下:
import android.content.Context;
public class ToolsUtil {
private static ToolsUtil toolsUtil;
private Context mContext;
private ToolsUtil(Context context) {
mContext = context.getApplicationContext();
}
public static ToolsUtil getInstance(Context context) {
if (toolsUtil == null) {
toolsUtil = new ToolsUtil(context);
}
return toolsUtil;
}
public String timeConversion(int time) {
int hour = 0;
int minutes = 0;
int sencond = 0;
int temp = time % 3600;
if (time > 3600) {
hour = time / 3600;
if (temp != 0) {
if (temp > 60) {
minutes = temp /