程序包 com.sh.util
类 DateUtil
java.lang.Object
com.sh.util.DateUtil
Description: 时间处理
Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static StringconvertDateToString(Date date, String pattern) 将日期对象转换成特定模式的字符串static StringconvertDateToString(Date date, String format, String toZoneId) 将时间转换为字符串,并指定时区static StringconvertDateZone(String date, String fromZoneId, String toZoneId, String format) 格式化时区static StringconvertDateZone(String date, ZoneId fromZone, ZoneId toZone, String format) static LocalDateTimeconvertDateZone(LocalDateTime date, ZoneId fromZone, ZoneId toZone) 时间转换static LocalDateTimeconvertDateZone(LocalDateTime date, TimeZone fromZone, TimeZone toZone) static TimestampconvertDateZone2(String date, String fromZoneId, String toZoneId, String format) static DateconvertStringToDate(String str, String pattern) static longgetMillisToDay(long millis) 将毫秒转化为天数static DategetToday()获取今天static StringgetToday(DataCenter dc, String pattern) 从数据库获取时间static String获取今天static booleanisInTimeRange_HHmm(String time, String begin, String end) 判断时间是否在指定范围内 时间格式为:HH:mm
-
构造器详细资料
-
DateUtil
public DateUtil()
-
-
方法详细资料
-
getToday
获取今天- 返回:
- Date
-
getToday
获取今天- 参数:
pattern- 表达式,如:yyyy-MM-dd- 返回:
- String
-
convertDateToString
将日期对象转换成特定模式的字符串- 参数:
date- 日期对象pattern- 字符串模式,如:yyyy年M月d日,yyyy-MM-dd等- 返回:
- 特定格式的字符串
-
convertDateToString
将时间转换为字符串,并指定时区- 参数:
date-format-toZoneId-- 返回:
-
convertStringToDate
-
getToday
从数据库获取时间- 参数:
dc- DataCenterpattern- String- 返回:
- String
-
getMillisToDay
public static long getMillisToDay(long millis) 将毫秒转化为天数- 参数:
millis- long- 返回:
- long
-
isInTimeRange_HHmm
判断时间是否在指定范围内 时间格式为:HH:mm- 参数:
time- Stringbegin- Stringend- String- 返回:
- boolean
-
convertDateZone
public static String convertDateZone(String date, String fromZoneId, String toZoneId, String format) 格式化时区- 参数:
date-fromZoneId-toZoneId-format-- 返回:
-
convertDateZone
-
convertDateZone2
-
convertDateZone
-
convertDateZone
时间转换- 参数:
date-fromZone-toZone-- 返回:
-