From e025fdc3803f3ce6cb9f2fdd7f0f62dcfbea73d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E8=8B=B1=E6=9D=B0?= <327782001@qq.com> Date: Fri, 21 Jul 2023 23:34:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=97=B6=E9=97=B4=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VueChatController.java | 2 ++ .../kwan/springbootkwan/utils/DateUtils.java | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/java/com/kwan/springbootkwan/utils/DateUtils.java diff --git a/src/main/java/com/kwan/springbootkwan/controller/VueChatController.java b/src/main/java/com/kwan/springbootkwan/controller/VueChatController.java index f75b4d2..59e0156 100644 --- a/src/main/java/com/kwan/springbootkwan/controller/VueChatController.java +++ b/src/main/java/com/kwan/springbootkwan/controller/VueChatController.java @@ -100,5 +100,7 @@ public class VueChatController { public Result delete(@RequestParam("idList") List idList) { return Result.ok(this.vueChatService.removeByIds(idList)); } + + } diff --git a/src/main/java/com/kwan/springbootkwan/utils/DateUtils.java b/src/main/java/com/kwan/springbootkwan/utils/DateUtils.java new file mode 100644 index 0000000..5f10fad --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/utils/DateUtils.java @@ -0,0 +1,26 @@ +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); + } +} -- GitLab