| | |
| | | * 时间戳转时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | * |
| | | * @param timestamp 时间戳 |
| | | * @param isDisplaySeconds 是否显示秒,true显示 |
| | | * @return - |
| | | */ |
| | | public static String getTimeFromTimestamp(long timestamp, boolean isDisplaySeconds) { |
| | | try { |
| | | String pattern = "yyyy-MM-dd HH:mm:ss"; |
| | | if (isDisplaySeconds) { |
| | | pattern = "yyyy-MM-dd HH:mm:ss"; |
| | | if (UserConfigManage.getInstance().getCurrentAppLanguage().equals(LocalManageUtil.en)) { |
| | | pattern = "dd-MM-yyyy HH:mm:ss"; |
| | | } |
| | | } else { |
| | | pattern = "yyyy-MM-dd HH:mm"; |
| | | if (UserConfigManage.getInstance().getCurrentAppLanguage().equals(LocalManageUtil.en)) { |
| | | pattern = "dd-MM-yyyy HH:mm"; |
| | | } |
| | | } |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, getLocale()); |
| | | Date date = new Date(timestamp); |
| | | return dateFormat.format(date); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 时间戳转时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | * |
| | | * @param timestamp 时间戳 |
| | | * ¬ * @return - |
| | | */ |
| | | public static String getTimeFromTimestamp(long timestamp) { |
| | | try { |
| | |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 时间戳转时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | * |