iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Java常用时间工具类总结(珍藏版)
  • 932
分享到

Java常用时间工具类总结(珍藏版)

2024-04-02 19:04:59 932人浏览 八月长安

Python 官方文档:入门教程 => 点击学习

摘要

目录常量介绍相关方法工具类源码肝了两天,重新整理了下时间工具类,以后我就以该时间工具类进行项目开发了,后会不定期更新功能,也欢迎留言需求,让工具类不断的完善。 常量介绍 相关方法

肝了两天,重新整理了下时间工具类,以后我就以该时间工具类进行项目开发了,后会不定期更新功能,也欢迎留言需求,让工具类不断的完善。

常量介绍

相关方法

工具类源码

package com.zyq.util.date;
 
import java.text.ParseException;
import java.text.SimpleDateFORMat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
 

public class DateUtils {
 
    
    public static final int WEEK_DAYS = 7;
    
    public static final int YEAR_MONTHS = 12;
    
    public static final int DAY_HOURS = 24;
    
    public static final int HOUR_MINUTES = 60;
    
    public static final int DAY_MINUTES = 1440;
    
    public static final int MINUTE_SECONDS = 60;
    
    public static final int HOUR_SECONDS = 3600;
    
    public static final int DAY_SECONDS = 86400;
    
    public static final long SECOND_MILLISECONDS = 1000L;
    
    public static final long MINUTE_MILLISECONDS = 60000L;
    
    public static final long HOUR_MILLISECONDS = 3600000L;
    
    public static final long DAY_MILLISECONDS = 86400000L;
    
    public static final int WEEK_1_MONDAY = 1;
    
    public static final int WEEK_2_TUESDAY = 2;
    
    public static final int WEEK_3_WEDNESDAY = 3;
    
    public static final int WEEK_4_THURSDAY = 4;
    
    public static final int WEEK_5_FRIDAY = 5;
    
    public static final int WEEK_6_SATURDAY = 6;
    
    public static final int WEEK_7_SUNDAY = 7;
    
    public static final int MONTH_1_JANUARY = 1;
    
    public static final int MONTH_2_FEBRUARY = 2;
    
    public static final int MONTH_3_MARCH = 3;
    
    public static final int MONTH_4_APRIL= 4;
    
    public static final int MONTH_5_MAY = 5;
    
    public static final int MONTH_6_JUNE = 6;
    
    public static final int MONTH_7_JULY = 7;
    
    public static final int MONTH_8_AUGUST = 8;
    
    public static final int MONTH_9_SEPTEMBER = 9;
    
    public static final int MONTH_10_OCTOBER = 10;
    
    public static final int MONTH_11_NOVEMBER = 11;
    
    public static final int MONTH_12_DECEMBER= 12;
    
    public static final String FORMAT_DATE = "yyyy-MM-dd";
    
    public static final String FORMAT_HOUR = "yyyy-MM-dd HH";
    
    public static final String FORMAT_MINUTE = "yyyy-MM-dd HH:mm";
    
    public static final String FORMAT_SECOND = "yyyy-MM-dd HH:mm:ss";
    
    public static final String FORMAT_MILLISECOND = "yyyy-MM-dd HH:mm:ss:SSS";
    
    public static final String FORMAT_NO_DATE = "yyyyMMdd";
    
    public static final String FORMAT_NO_HOUR = "yyyyMMddHH";
    
    public static final String FORMAT_NO_MINUTE = "yyyyMMddHHmm";
    
    public static final String FORMAT_NO_SECOND = "yyyyMMddHHmmss";
    
    public static final String FORMAT_NO_MILLISECOND = "yyyyMMddHHmmssSSS";
    
    private static final Map<String, SimpleDateFormat> simpleDateFormatMap = new HashMap<String, SimpleDateFormat>();
    static {
        simpleDateFormatMap.put(FORMAT_DATE, new SimpleDateFormat(FORMAT_DATE));
        simpleDateFormatMap.put(FORMAT_HOUR, new SimpleDateFormat(FORMAT_HOUR));
        simpleDateFormatMap.put(FORMAT_MINUTE, new SimpleDateFormat(FORMAT_MINUTE));
        simpleDateFormatMap.put(FORMAT_SECOND, new SimpleDateFormat(FORMAT_SECOND));
        simpleDateFormatMap.put(FORMAT_MILLISECOND, new SimpleDateFormat(FORMAT_MILLISECOND));
        simpleDateFormatMap.put(FORMAT_NO_DATE, new SimpleDateFormat(FORMAT_NO_DATE));
        simpleDateFormatMap.put(FORMAT_NO_HOUR, new SimpleDateFormat(FORMAT_NO_HOUR));
        simpleDateFormatMap.put(FORMAT_NO_MINUTE, new SimpleDateFormat(FORMAT_NO_MINUTE));
        simpleDateFormatMap.put(FORMAT_NO_SECOND, new SimpleDateFormat(FORMAT_NO_SECOND));
        simpleDateFormatMap.put(FORMAT_NO_MILLISECOND, new SimpleDateFormat(FORMAT_NO_MILLISECOND));
    }
 
    
    private static SimpleDateFormat getSimpleDateFormat(String formatStyle) {
        SimpleDateFormat dateFormat = simpleDateFormatMap.get(formatStyle);
        if (Objects.nonNull(dateFormat)) {
            return dateFormat;
        }
        return new SimpleDateFormat(formatStyle);
    }
 
    
    public static String format(Date date, String formatStyle) {
        if (Objects.isNull(date)) {
            return "";
        }
        return getSimpleDateFormat(formatStyle).format(date);
    }
 
    
    public static String formatDate(Date date) {
        return format(date, FORMAT_DATE);
    }
 
    
    public static String formatDateTime(Date date) {
        return format(date, FORMAT_SECOND);
    }
 
    
    public static String formatDateTimeStamp(Date date) {
        return format(date, FORMAT_MILLISECOND);
    }
 
    
    public static Date parseDate(String dateString) {
        return parse(dateString, FORMAT_DATE);
    }
 
    
    public static Date parseDateTime(String dateTimeStr) {
        return parse(dateTimeStr, FORMAT_SECOND);
    }
 
    
    public static Date parseDateTimeStamp(String dateTimeStampStr) {
        return parse(dateTimeStampStr, FORMAT_MILLISECOND);
    }
 
    
    public static Date parse(String dateString, String formatStyle) {
        String s = getString(dateString);
        if (s.isEmpty()) {
            return null;
        }
        try {
            return getSimpleDateFormat(formatStyle).parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
 
    
    private static String getString(String s) {
        return Objects.isNull(s) ? "" : s.trim();
    }
 
    
    public static Date getDateStart(Date date) {
        if (Objects.isNull(date)) {
            return null;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
 
    
    public static Date getDateEnd(Date date) {
        if (Objects.isNull(date)) {
            return null;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        calendar.set(Calendar.MILLISECOND, 999);
        return calendar.getTime();
    }
 
    
    public static int getDateNo(Date date) {
        if (Objects.isNull(date)) {
            return 0;
        }
        return Integer.valueOf(format(date, FORMAT_NO_DATE));
    }
 
    
    public static long getDateTimeNo(Date date) {
        if (Objects.isNull(date)) {
            return 0L;
        }
        return Long.valueOf(format(date, FORMAT_NO_SECOND));
    }
 
    
    public static long getDateTimeStampNo(Date date) {
        if (Objects.isNull(date)) {
            return 0L;
        }
        return Long.valueOf(format(date, FORMAT_NO_MILLISECOND));
    }
 
    
    public static int getWeek(Date date) {
        if (Objects.isNull(date)) {
            return 0;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return getWeek(calendar);
    }
 
    
    private static int getWeek(Calendar calendar) {
        switch (calendar.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY:
            return 1;
        case Calendar.TUESDAY:
            return 2;
        case Calendar.WEDNESDAY:
            return 3;
        case Calendar.THURSDAY:
            return 4;
        case Calendar.FRIDAY:
            return 5;
        case Calendar.SATURDAY:
            return 6;
        case Calendar.SUNDAY:
            return 7;
        default:
            return 0;
        }
    }
 
    
    public static int getWeekOfYear(Date date) {
        if (Objects.isNull(date)) {
            return -1;
        }
        int weeks = getWeekOfYearIgnoreLastYear(date);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.MONTH, Calendar.JANUARY);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        int week = getWeek(calendar);
        if (week == 1) {
            return weeks;
        }
        return weeks - 1;
    }
 
    
    public static int getWeekOfYearIgnoreLastYear(Date date) {
        if (Objects.isNull(date)) {
            return -1;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int days = calendar.get(Calendar.DAY_OF_YEAR);
        int weeks = days / 7;
        // 如果是 7 的倍数,则表示恰好是多少周
        if (days % 7 == 0) {
            return weeks;
        }
        // 如果有余数,则需要再加 1
        return weeks + 1;
    }
 
    
    public static Datenode getDateNode(Date date) {
        if (Objects.isNull(date)) {
            return null;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        DateNode node = new DateNode();
        node.setTime(format(date, FORMAT_MILLISECOND));
        node.setYear(calendar.get(Calendar.YEAR));
        node.setMonth(calendar.get(Calendar.MONTH) + 1);
        node.setDay(calendar.get(Calendar.DAY_OF_MONTH));
        node.setHour(calendar.get(Calendar.HOUR_OF_DAY));
        node.setMinute(calendar.get(Calendar.MINUTE));
        node.setSecond(calendar.get(Calendar.SECOND));
        node.setMillisecond(calendar.get(Calendar.MILLISECOND));
        node.setWeek(getWeek(calendar));
        node.setDayOfYear(calendar.get(Calendar.DAY_OF_YEAR));
        node.setWeekOfYear(getWeekOfYear(date));
        node.setWeekOfYearIgnoreLastYear(getWeekOfYearIgnoreLastYear(date));
        node.setMillisecondStamp(date.getTime());
        node.setSecondStamp(node.getMillisecondStamp() / 1000);
        return node;
    }
 
    
    public static Date add(Date date, int field, int amount) {
        if (Objects.isNull(date)) {
            return null;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(field, amount);
        return calendar.getTime();
    }
 
    
    public static Date addYear(Date date, int year) {
        return add(date, Calendar.YEAR, year);
    }
 
    
    public static Date addMonth(Date date, int month) {
        return add(date, Calendar.MONTH, month);
    }
 
    
    public static Date aDDDay(Date date, int day) {
        return add(date, Calendar.DAY_OF_YEAR, day);
    }
 
    
    public static Date addWeek(Date date, int week) {
        return add(date, Calendar.WEEK_OF_YEAR, week);
    }
 
    
    public static Date addHour(Date date, int hour) {
        return add(date, Calendar.HOUR_OF_DAY, hour);
    }
 
    
    public static Date addMinute(Date date, int minute) {
        return add(date, Calendar.MINUTE, minute);
    }
 
    
    public static Date addSecond(Date date, int second) {
        return add(date, Calendar.SECOND, second);
    }
 
    
    public static Date addMillisecond(Date date, int millisecond) {
        return add(date, Calendar.MILLISECOND, millisecond);
    }
 
    
    public static Date getWeekDate(Date date, int index) {
        if (index < WEEK_1_MONDAY || index > WEEK_7_SUNDAY) {
            return null;
        }
        int week = getWeek(date);
        return addDay(date, index - week);
    }
 
    
    public static Date getWeekDateStart(Date date) {
        return getDateStart(getWeekDate(date, WEEK_1_MONDAY));
    }
 
    
    public static Date getWeekDateEnd(Date date) {
        return getWeekDateEnd(getWeekDate(date, WEEK_7_SUNDAY));
    }
 
    
    public static List<Date> getWeekDateList(Date date) {
        if (Objects.isNull(date)) {
            return Collections.emptyList();
        }
        // 获取本周开始时间
        Date weekFromDate = getWeekDateStart(date);
        // 获取本周截止时间
        Date weekeEndDate = getWeekDateEnd(date);
        return getBetweenDateList(weekFromDate, weekeEndDate, true);
    }
 
    
    public static List<String> getWeekDateList(String dateString) {
        Date date = parseDate(dateString);
        if (Objects.isNull(date)) {
            return Collections.emptyList();
        }
        return getDateStrList(getWeekDateList(date));
    }
 
    
    public static List<Date> getMonthDateList(Date date) {
        if (Objects.isNull(date)) {
            return Collections.emptyList();
        }
        Date monthDateStart = getMonthDateStart(date);
        Date monthDateEnd = getMonthDateEnd(date);
        return getBetweenDateList(monthDateStart, monthDateEnd, true);
    }
 
    
    public static List<String> getMonthDateList(String dateString) {
        Date date = parseDate(dateString);
        if (Objects.isNull(date)) {
            return Collections.emptyList();
        }
        return getDateStrList(getMonthDateList(date));
    }
    
    
    public static Date getMonthDateStart(Date date) {
        if (Objects.isNull(date)) {
            return null;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        return getDateStart(calendar.getTime());
    }
 
    
    public static Date getMonthDateEnd(Date date) {
        if (Objects.isNull(date)) {
            return null;
        }
        Date monthDateStart = getMonthDateStart(date);
        Date nextMonthDateStart = getMonthDateStart(addMonth(monthDateStart, 1));
        return getDateEnd(addDay(nextMonthDateStart, -1));
    }
 
    
    public static int countBetweenDays(Date date1, Date date2) {
        if (Objects.isNull(date1) || Objects.isNull(date2)) {
            return -1;
        }
        // 获取两个日期 0 点 0 时 0 分 0 秒 0 毫秒时的时间戳(毫秒级)
        long t1 = getDateStart(date1).getTime();
        long t2 = getDateStart(date2).getTime();
        // 相差天数 = 相差的毫秒数 / 一天的毫秒数
        return (int) (Math.abs(t1 - t2) / DAY_MILLISECONDS);
    }
 
    
    public static List<Date> getBetweenDateList(Date date1, Date date2) {
        return getBetweenDateList(date1, date2, false);
    }
 
    
    public static List<Date> getBetweenDateList(Date date1, Date date2, boolean isContainParams) {
        if (Objects.isNull(date1) || Objects.isNull(date2)) {
            return Collections.emptyList();
        }
        // 确定前后日期
        Date fromDate = date1;
        Date toDate = date2;
        if (date2.before(date1)) {
            fromDate = date2;
            toDate = date1;
        }
        // 获取两个日期每天的开始时间
        Date from = getDateStart(fromDate);
        Date to = getDateStart(toDate);
        // 获取日期,开始循环
        List<Date> dates = new ArrayList<Date>();
        if (isContainParams) {
            dates.add(from);
        }
        Date date = from;
        boolean isBefore = true;
        while (isBefore) {
            date = addDay(date, 1);
            isBefore = date.before(to);
            if (isBefore) {
                dates.add(getDateStart(date));
            }
        }
        if (isContainParams) {
            dates.add(to);
        }
        return dates;
    }
 
    
    public static List<String> getBetweenDateList(String dateString1, String dateString2) {
        return getBetweenDateList(dateString1, dateString2, false);
    }
 
    
    public static List<String> getBetweenDateList(String dateString1, String dateString2, boolean isContainParams) {
        Date date1 = parseDate(dateString1);
        Date date2 = parseDate(dateString2);
        List<Date> dates = getBetweenDateList(date1, date2, isContainParams);
        return getDateStrList(dates);
    }
 
    
    public static List<String> getDateStrList(List<Date> dates) {
        if (dates.isEmpty()) {
            return Collections.emptyList();
        }
        List<String> dateList = new ArrayList<String>();
        for (Date date : dates) {
            dateList.add(formatDate(date));
        }
        return dateList;
    }
 
    static class DateNode {
        
        private int year;
        
        private int month;
        
        private int day;
        
        private int hour;
        
        private int minute;
        
        private int second;
        
        private int millisecond;
        
        private int week;
        
        private int dayOfYear;
        
        private int weekOfYear;
        
        private int weekOfYearIgnoreLastYear;
        
        private long secondStamp;
        
        private long millisecondStamp;
        
        private String time;
 
        public int getYear() {
            return year;
        }
 
        public void setYear(int year) {
            this.year = year;
        }
 
        public int getMonth() {
            return month;
        }
 
        public void setMonth(int month) {
            this.month = month;
        }
 
        public int getDay() {
            return day;
        }
 
        public void setDay(int day) {
            this.day = day;
        }
 
        public int getHour() {
            return hour;
        }
 
        public void setHour(int hour) {
            this.hour = hour;
        }
 
        public int getMinute() {
            return minute;
        }
 
        public void setMinute(int minute) {
            this.minute = minute;
        }
 
        public int getSecond() {
            return second;
        }
 
        public void setSecond(int second) {
            this.second = second;
        }
 
        public int getMillisecond() {
            return millisecond;
        }
 
        public void setMillisecond(int millisecond) {
            this.millisecond = millisecond;
        }
 
        public int getWeek() {
            return week;
        }
 
        public void setWeek(int week) {
            this.week = week;
        }
 
        public int getDayOfYear() {
            return dayOfYear;
        }
 
        public void setDayOfYear(int dayOfYear) {
            this.dayOfYear = dayOfYear;
        }
 
        public int getWeekOfYear() {
            return weekOfYear;
        }
 
        public void setWeekOfYear(int weekOfYear) {
            this.weekOfYear = weekOfYear;
        }
 
        public int getWeekOfYearIgnoreLastYear() {
            return weekOfYearIgnoreLastYear;
        }
 
        public void setWeekOfYearIgnoreLastYear(int weekOfYearIgnoreLastYear) {
            this.weekOfYearIgnoreLastYear = weekOfYearIgnoreLastYear;
        }
 
        public long getSecondStamp() {
            return secondStamp;
        }
 
        public void setSecondStamp(long secondStamp) {
            this.secondStamp = secondStamp;
        }
 
        public long getMillisecondStamp() {
            return millisecondStamp;
        }
 
        public void setMillisecondStamp(long millisecondStamp) {
            this.millisecondStamp = millisecondStamp;
        }
 
        public String getTime() {
            return time;
        }
 
        public void setTime(String time) {
            this.time = time;
        }
 
    }
}

到此这篇关于Java常用时间工具类总结(珍藏版)的文章就介绍到这了,更多相关Java时间工具类内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!

--结束END--

本文标题: Java常用时间工具类总结(珍藏版)

本文链接: https://www.lsjlt.com/news/164916.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Java常用时间工具类总结(珍藏版)
    目录常量介绍相关方法工具类源码肝了两天,重新整理了下时间工具类,以后我就以该时间工具类进行项目开发了,后会不定期更新功能,也欢迎留言需求,让工具类不断的完善。 常量介绍 相关方法 ...
    99+
    2024-04-02
  • Java常用工具类总结
    目录一、线程协作、控制并发流程的工具类二、CountDownLatch倒计时门闩三、Semaphore信号量四、Condition接口(又称条件对象)五、CyclicBarrier和...
    99+
    2024-04-02
  • stackoverflow常用工具库总结
    目录简介API概览安装和使用简介 每个前端开发人员都有自己的 utils 库, 这些方法我们高频使用,但又要在每个项目中重写。 今天我要给大家介绍一款超小且实用的函数工具库:&nb...
    99+
    2023-03-06
    stackoverflow工具库 stackoverflow常用工具
  • Java时间工具类Date的常用处理方法
    目录前言Date 类构造方法常用方法前言 Date 类 Date 类表示系统特定的时间戳,可以精确到毫秒。Date 对象表示时间的默认顺序是星期、月、日、小时、分、秒、年。 构造方法...
    99+
    2024-04-02
  • Java常用时间格式转换工具类有哪些
    小编给大家分享一下Java常用时间格式转换工具类有哪些,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!  开发过程中,经常遇到各种时间格式的转换。今天特此以博客的方...
    99+
    2023-06-02
  • 总结Java常用的时间相关转化
    Java常用的时间相关转化 下面代码的一些变量基本解释说明 datePattern:时间对应的字符串格式 date: 时间 dateStr:字符串格式的时间 指定的几个常量: p...
    99+
    2024-04-02
  • Java常用工具类汇总 附示例代码
    一、FileUtils private static void fileUtilsTest() { try { //读取文件内容 Stri...
    99+
    2024-04-02
  • Java中的常用类总结
    这篇文章主要讲解了“Java中的常用类总结”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Java中的常用类总结”吧!目录Java常用类包装类包装类中的常量包装类的构造方法包装类中的常用方法M...
    99+
    2023-06-20
  • Java常用工具类汇总以及示例代码
    今天小编给大家分享的是Java常用工具类汇总以及示例代码,相信很多人都不太了解,为了让大家更加了解,所以给大家总结了以下内容,一起往下看吧。一定会有所收获的哦。Java是什么Java是一门面向对象编程语言,可以编写桌面应用程序、Web应用程...
    99+
    2023-06-14
  • Java中的时间工具类有哪些
    Java中的时间工具类有哪些?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。具体如下:package org.zhy.date;import java.text.DateForm...
    99+
    2023-05-31
    java ava
  • Java并发工具类Exchanger的相关知识总结
    一、Exchanger的理解 Exchanger 属于java.util.concurrent包; Exchanger 是 JDK 1.5 开始提供的一个用于两个工...
    99+
    2024-04-02
  • 常用的Python代码调试工具总结
    前言 我自己常用的简单Python代码调试工具是IDLE和Sublime3,IDLE很少使用了,基本上用Sublime3稍微多一些,Sublime3因为简单方便更直观。(VSCode...
    99+
    2024-04-02
  • java中DateUtils时间工具类如何实现
    这篇文章将为大家详细讲解有关java中DateUtils时间工具类如何实现,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。具体内容如下package com.example.administrat...
    99+
    2023-05-30
    java dateutils
  • java DateUtil工具类时间戳类型转换详解
    本文实例为大家分享了DateUtil工具类时间戳类型转换的具体代码,供大家参考,具体内容如下package com.sinosoft.media.sms.util; import java.text.ParseException; impo...
    99+
    2023-05-30
    java dateutil dat
  • Java中TimedCache带时间缓存工具类怎么用
    这篇文章主要为大家展示了“Java中TimedCache带时间缓存工具类怎么用”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Java中TimedCache带时间缓存工具类怎么用”这篇文章吧。简述...
    99+
    2023-06-25
  • Java TimedCache 带时间缓存工具类详解使用
    简述 我们在工作中会碰到需要使用带过期时间的缓存场景。但是使用redis有太重了,毕竟缓存的数据很小,放在内存够够的。hutools提供了TimedCache时间缓存工具,可以实现该...
    99+
    2024-04-02
  • java常用工具类有哪些
    这篇文章给大家分享的是有关java常用工具类有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。java中有用的工具集任何语言都要处理日期,map类型,字符串,数字类型的数据,这里找到一些用java经常处理这些数...
    99+
    2023-06-03
  • Java中String类常用类型实例总结
    目录1.创建字符串的方法1.1构造1.2引用对象 2.字符串的比较3.字符串的不可改变性4.数组转字符串 5.判断是否是数字字符串  isNumberChar(  ) 6....
    99+
    2024-04-02
  • 七个非常实用的Python工具包总结
    目录一、Faker二、Pywebio三、Airflow四、Loguru五、Pydash六、Weights & Biases七、PyCaretSummary一、Faker 生产...
    99+
    2024-04-02
  • Vue项目中常用的工具函数总结
    目录前言一、自定义聚焦指令1、方式一2、方式二3、方式三二、输入框防抖1、需求2、思路3、代码实现三、关键字高亮1、需求2、思路3、代码演示四、格式化Excel表格中存储的时间1、需...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作