类 ZonedDateTimeUtils

java.lang.Object
com.sie.mbm.mom.framework.common.util.ZonedDateTimeUtils

public class ZonedDateTimeUtils extends Object
ZonedDateTime工具包
  • 构造器详细资料

    • ZonedDateTimeUtils

      public ZonedDateTimeUtils()
  • 方法详细资料

    • transTimeZone

      public ZonedDateTime transTimeZone(ZonedDateTime time, String zoneId)
      时区转换
      参数:
      time -
      zoneId - 时区
      返回:
    • getSecond

      public long getSecond(ZonedDateTime dateTime1, ZonedDateTime dateTime2)
      计算两个时间相差的秒,并取绝对值
      参数:
      dateTime1 -
      dateTime2 -
      返回:
    • getUTCStr

      public static String getUTCStr()
      当前时间 UTC时区 例:2011-12-03T10:15:30Z
      返回:
    • getUTCStr

      public static String getUTCStr(ZonedDateTime zonedDateTime)
      获取UTC时区 例:2011-12-03T10:15:30Z
      返回:
    • parseUTCStr

      public static ZonedDateTime parseUTCStr(String zonedStr)
      ZonedDateTime时间格式转换, 2024-12-18T08:43:35Z
      参数:
      zonedStr -
      返回:
    • getLocalDateTimeStr

      public static String getLocalDateTimeStr(ZonedDateTime zonedDateTime)
      ZonedDateTime转当地时间时间格式转换:yyyy-MM-dd HH:mm:ss
      参数:
      zonedDateTime -
      返回:
    • getZoneId

      public static ZoneId getZoneId()
      获取当前时区 默认从请求头上获取, 如果没有则使用系统时区
      返回:
    • isBefore

      public boolean isBefore(ZonedDateTime first, ZonedDateTime two)
      比较两个ZonedDateTime时间大小, 支持不同时区的比较
      参数:
      first -
      two -
      返回:
    • isAfter

      public boolean isAfter(ZonedDateTime first, ZonedDateTime two)
      比较两个ZonedDateTime时间大小, 支持不同时区的比较
      参数:
      first -
      two -
      返回:
    • compare

      public int compare(ZonedDateTime first, ZonedDateTime two)
      比较两个ZonedDateTime时间大小, 支持不同时区的比较
      参数:
      first -
      two -
      返回:
    • nowUtc

      public static ZonedDateTime nowUtc()
      获取当前UTC时间
      返回: