| | |
| | | public class TimeUtils { |
| | | |
| | | /** |
| | | * 获取分钟 |
| | | * |
| | | * @param timestamp 时间戳 |
| | | * @return - |
| | | */ |
| | | public static String getMinuteTime(long timestamp) { |
| | | try { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("mm", Locale.ENGLISH); |
| | | Date date = new Date(timestamp); |
| | | return dateFormat.format(date); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 时间戳转时间(格式:yyyy-MM-dd) |
| | | * |
| | | * @param timestamp 时间戳 |
| | | * @return - |
| | | */ |
| | | public static String getDateTimestamp(long timestamp) { |
| | | try { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd ", Locale.ENGLISH); |
| | | Date date = new Date(timestamp); |
| | | return dateFormat.format(date); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 时间戳转时间(格式:yyyy-MM-dd HH:mm:ss) |
| | | * |
| | | * @param timestamp 时间戳 |