类 ZonedDateTimeUtils
java.lang.Object
com.sie.mbm.mom.framework.common.util.ZonedDateTimeUtils
ZonedDateTime工具包
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明intcompare(ZonedDateTime first, ZonedDateTime two) 比较两个ZonedDateTime时间大小, 支持不同时区的比较static StringgetLocalDateTimeStr(ZonedDateTime zonedDateTime) ZonedDateTime转当地时间时间格式转换:yyyy-MM-dd HH:mm:sslonggetSecond(ZonedDateTime dateTime1, ZonedDateTime dateTime2) 计算两个时间相差的秒,并取绝对值static String当前时间 UTC时区 例:2011-12-03T10:15:30Zstatic StringgetUTCStr(ZonedDateTime zonedDateTime) 获取UTC时区 例:2011-12-03T10:15:30Zstatic ZoneId获取当前时区 默认从请求头上获取, 如果没有则使用系统时区booleanisAfter(ZonedDateTime first, ZonedDateTime two) 比较两个ZonedDateTime时间大小, 支持不同时区的比较booleanisBefore(ZonedDateTime first, ZonedDateTime two) 比较两个ZonedDateTime时间大小, 支持不同时区的比较static ZonedDateTimenowUtc()获取当前UTC时间static ZonedDateTimeparseUTCStr(String zonedStr) ZonedDateTime时间格式转换, 2024-12-18T08:43:35ZtransTimeZone(ZonedDateTime time, String zoneId) 时区转换
-
构造器详细资料
-
ZonedDateTimeUtils
public ZonedDateTimeUtils()
-
-
方法详细资料
-
transTimeZone
时区转换- 参数:
time-zoneId- 时区- 返回:
-
getSecond
计算两个时间相差的秒,并取绝对值- 参数:
dateTime1-dateTime2-- 返回:
-
getUTCStr
当前时间 UTC时区 例:2011-12-03T10:15:30Z- 返回:
-
getUTCStr
获取UTC时区 例:2011-12-03T10:15:30Z- 返回:
-
parseUTCStr
ZonedDateTime时间格式转换, 2024-12-18T08:43:35Z- 参数:
zonedStr-- 返回:
-
getLocalDateTimeStr
ZonedDateTime转当地时间时间格式转换:yyyy-MM-dd HH:mm:ss- 参数:
zonedDateTime-- 返回:
-
getZoneId
获取当前时区 默认从请求头上获取, 如果没有则使用系统时区- 返回:
-
isBefore
比较两个ZonedDateTime时间大小, 支持不同时区的比较- 参数:
first-two-- 返回:
-
isAfter
比较两个ZonedDateTime时间大小, 支持不同时区的比较- 参数:
first-two-- 返回:
-
compare
比较两个ZonedDateTime时间大小, 支持不同时区的比较- 参数:
first-two-- 返回:
-
nowUtc
获取当前UTC时间- 返回:
-