/**
* 描述 获取当前日期 格式:(yyyy-MM-dd hh:mm:ss)
*
* @param
* @return String
* @author ***
* @date 2018/11/26 10:33
*/
public static String getCurrentFullTime() {
return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
/**
* 描述 获取当前日期 格式:(yyyy-MM-dd)
*
* @param
* @return String
* @author ***
* @date 2018/11/26 10:33
*/
public static String getCurrentDate() {
LocalDate currentDate = LocalDate.now();
return String.valueOf(currentDate);
}
/**
* 描述 获取今天星期几
*
* @param
* @return String
* @author ***
* @date 2018/11/26 10:53
*/
public static String getDayOfTheWeek() {
String[][] strArray = {{"MONDAY", "一"}, {"TUESDAY", "二"}, {"WEDNESDAY", "三"}, {"THURSDAY", "四"}, {"FRIDAY", "五"}, {"SATURDAY", "六"}, {"SUNDAY", "日"}};
LocalDate currentDate = LocalDate.now();
String k = String.valueOf(currentDate.getDayOfWeek());
//获取行数
for (int i = 0; i < strArray.length; i++) {
if (k.equals(strArray[i][0])) {
k = strArray[i][1];
break;
}
}
return "星期" + k;
}
版权声明:本文为HSH205572原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。