43 lines
946 B
Java
43 lines
946 B
Java
package com.uiuios.aios.utils;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
|
|
/**
|
|
* 作者 mjsheng
|
|
* 日期 2018/8/31 09:50
|
|
* 邮箱 501802639@qq.com
|
|
* 来自:
|
|
*/
|
|
|
|
public class DataUtil {
|
|
private static SimpleDateFormat day = new SimpleDateFormat("MM月dd日");
|
|
private static SimpleDateFormat hour = new SimpleDateFormat("HH:mm");
|
|
private static SimpleDateFormat minute = new SimpleDateFormat("mm");
|
|
|
|
/**
|
|
* 格式化日期(精确到天)
|
|
*/
|
|
public static String formatDateDay() {
|
|
return day.format(new Date());
|
|
}
|
|
|
|
public static String formatDateTime() {
|
|
return hour.format(new Date());
|
|
}
|
|
|
|
/**
|
|
* 格式化日期(hour)
|
|
*/
|
|
public static String formatDateHour() {
|
|
return hour.format(new Date());
|
|
}
|
|
|
|
/**
|
|
* 格式化日期(minute)
|
|
*/
|
|
public static String formatDateMinute() {
|
|
return minute.format(new Date());
|
|
}
|
|
}
|