排程详情
This commit is contained in:
@@ -293,6 +293,34 @@ public class ZYTimeUtils {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* HH:mm:ss 转 HH:mm
|
||||
* 例如:
|
||||
* 08:00:00 -> 08:00
|
||||
* 18:35:29 -> 18:35
|
||||
*/
|
||||
public static String formatHHmm(String time) {
|
||||
if (TextUtils.isEmpty(time)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
SimpleDateFormat sourceFormat =
|
||||
new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
|
||||
|
||||
SimpleDateFormat targetFormat =
|
||||
new SimpleDateFormat("HH:mm", Locale.getDefault());
|
||||
|
||||
Date date = sourceFormat.parse(time);
|
||||
|
||||
return targetFormat.format(date);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getStrTimeData_H_M(Date date) {
|
||||
String timeString = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
||||
|
||||
Reference in New Issue
Block a user