fix:时间工具

上级 f6031bbc
...@@ -100,5 +100,7 @@ public class VueChatController { ...@@ -100,5 +100,7 @@ public class VueChatController {
public Result delete(@RequestParam("idList") List<Long> idList) { public Result delete(@RequestParam("idList") List<Long> idList) {
return Result.ok(this.vueChatService.removeByIds(idList)); return Result.ok(this.vueChatService.removeByIds(idList));
} }
} }
package com.kwan.springbootkwan.utils;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
/**
* 时间工具类
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/21 23:29
*/
public class DateUtils {
public static void main(String[] args) {
// 获取当前日期时间
DateTime now = DateUtil.date();
// 获取当前日期所在的周数
int weekOfYear = DateUtil.weekOfYear(now);
// 获取当前日期所在的月份,并格式化为两位数字
String month = String.format("%02d", DateUtil.month(now) + 1);
// 将周数和月份拼接成字符串
String result = StrUtil.format("当前日期所在的周数:{},当前日期所在的月份:{}", weekOfYear, month);
System.out.println(result);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册