|
|
|
@ -6,7 +6,7 @@ import java.util.Date; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 时间转换工具类 |
|
|
|
|
* the tool of time transforming |
|
|
|
|
* Created by frank on 2018/11/12. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
@ -15,9 +15,10 @@ public class TimeUtil { |
|
|
|
|
private static final String YMDHMS = "yyyy-MM-dd HH:mm:ss"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 时间戳年月日时分秒 |
|
|
|
|
* convert timestramp into String |
|
|
|
|
* |
|
|
|
|
* @param time time |
|
|
|
|
* @return 年月日时分秒 yyyy/MM/dd HH:mm:ss |
|
|
|
|
* @return yyyy/MM/dd HH:mm:ss |
|
|
|
|
*/ |
|
|
|
|
public static String getDetailTime(long time) { |
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat(YMDHMS, Locale.getDefault()); |
|
|
|
@ -26,9 +27,10 @@ public class TimeUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 时间转为时间戳 |
|
|
|
|
* convert normal time into timestamp |
|
|
|
|
* |
|
|
|
|
* @param time time |
|
|
|
|
* @return 时间戳 |
|
|
|
|
* @return timestamp |
|
|
|
|
*/ |
|
|
|
|
public static long getLongTime(String time, Locale locale) { |
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YMDHMS, locale); |
|
|
|
@ -52,9 +54,10 @@ public class TimeUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取视频时长 |
|
|
|
|
* convert timestamp into video time |
|
|
|
|
* |
|
|
|
|
* @param time time |
|
|
|
|
* @return 视频时长 |
|
|
|
|
* @return video time |
|
|
|
|
*/ |
|
|
|
|
public static String getVideoTime(long time) { |
|
|
|
|
if (time <= 0) |
|
|
|
|