程序包 com.sh.util

类 DateUtil

java.lang.Object
com.sh.util.DateUtil

public class DateUtil extends Object
Description: 时间处理 Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
  • 构造器详细资料

    • DateUtil

      public DateUtil()
  • 方法详细资料

    • getToday

      public static Date getToday()
      获取今天
      返回:
      Date
    • getToday

      public static String getToday(String pattern)
      获取今天
      参数:
      pattern - 表达式,如:yyyy-MM-dd
      返回:
      String
    • convertDateToString

      public static String convertDateToString(Date date, String pattern)
      将日期对象转换成特定模式的字符串
      参数:
      date - 日期对象
      pattern - 字符串模式,如:yyyy年M月d日,yyyy-MM-dd等
      返回:
      特定格式的字符串
    • convertDateToString

      public static String convertDateToString(Date date, String format, String toZoneId)
      将时间转换为字符串,并指定时区
      参数:
      date -
      format -
      toZoneId -
      返回:
    • convertStringToDate

      public static Date convertStringToDate(String str, String pattern)
    • getToday

      public static String getToday(DataCenter dc, String pattern)
      从数据库获取时间
      参数:
      dc - DataCenter
      pattern - String
      返回:
      String
    • getMillisToDay

      public static long getMillisToDay(long millis)
      将毫秒转化为天数
      参数:
      millis - long
      返回:
      long
    • isInTimeRange_HHmm

      public static boolean isInTimeRange_HHmm(String time, String begin, String end)
      判断时间是否在指定范围内 时间格式为:HH:mm
      参数:
      time - String
      begin - String
      end - String
      返回:
      boolean
    • convertDateZone

      public static String convertDateZone(String date, String fromZoneId, String toZoneId, String format)
      格式化时区
      参数:
      date -
      fromZoneId -
      toZoneId -
      format -
      返回:
    • convertDateZone

      public static String convertDateZone(String date, ZoneId fromZone, ZoneId toZone, String format)
    • convertDateZone2

      public static Timestamp convertDateZone2(String date, String fromZoneId, String toZoneId, String format)
    • convertDateZone

      public static LocalDateTime convertDateZone(LocalDateTime date, TimeZone fromZone, TimeZone toZone)
    • convertDateZone

      public static LocalDateTime convertDateZone(LocalDateTime date, ZoneId fromZone, ZoneId toZone)
      时间转换
      参数:
      date -
      fromZone -
      toZone -
      返回: