时间戳工具类,获取今天0时刻和今天23分59分59时刻
发布日期:2022-02-21 17:40:25 浏览次数:32 分类:技术文章

本文共 776 字,大约阅读时间需要 2 分钟。

/** * Describe : 时间戳工具类 * Author   : Chenhao86 * Date     : Creat in 2021/8/3 15:42 */public class TimeStampUtil {
/** * 获取今天0点时的时间戳 */ public static Long getTodayZeroPointTimestamps() {
Long currentTimestamps = System.currentTimeMillis(); Long oneDayTimestamps = Long.valueOf(60 * 60 * 24 * 1000); return (currentTimestamps - (currentTimestamps + 60 * 60 * 8 * 1000) % oneDayTimestamps) / 1000; } /** * 获取今天23点59分59秒的时间戳 */ public static Long getTodayLastPointTimestamps() {
Calendar calendar = Calendar.getInstance(); calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 23, 59, 59); return calendar.getTime().getTime() / 1000; }}

转载地址:https://blog.csdn.net/weixin_40597409/article/details/119884871 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Netty | 02 - 客户端启动流程以及常用api笔记
下一篇:flink集群笔记

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月07日 11时30分06秒