public class TimeUtil extends StringForDate
| Constructor and Description |
|---|
TimeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getDateOfMonthBegin(String p_strDate,
String p_format)
获取指定月份的第一天
|
static String |
getDateOfMonthEnd(String p_strDate,
String p_format)
获取指定月份的最后一天
|
static int |
getDayOfDate(Date p_date)
获取指定日期的日份
|
static long |
getDayOfMonth(Date p_date)
获取字符日期一个月的天数
|
static int |
getHourOfDate(Date p_date)
获取指定日期的小时
|
static long |
getHoursOfTowDiffDate(String p_startDate,
String p_endDate)
计算两个时刻之间的时间差
|
static long |
getMillisOfDate(Date p_date)
获取指定日期的毫秒
|
static long |
getMillisOfTowDiffDate(Date p_startDate,
Date p_endDate)
计算两个时刻之间的时间差
|
static long |
getMillisOfTowDiffDate(String p_startDate,
String p_endDate)
计算两个时刻之间的时间差
|
static int |
getMinuteOfDate(Date p_date)
获取指定日期的分钟
|
static long |
getMinutesOfTowDiffDate(String p_startDate,
String p_endDate)
计算两个时刻之间的时间差
|
static int |
getMonthOfDate(Date p_date)
获取指定日期的月份
|
static String |
getNowOfDateByFormat(String p_format)
获取指定日期格式当前日期的字符型日期
|
static int |
getSecondOfDate(Date p_date)
获取指定日期的秒钟
|
static long |
getSeconds()
获取当天的秒数
|
static long |
getSecondsOfTowDiffDate(String p_startDate,
String p_endDate)
计算两个时刻之间的时间差
|
static String |
getStrTimeByUTC(long utc,
String format)
获取指定utc时间的格式化字符串
|
static String |
getSystemOfDateByFormat(String p_format)
获取指定日期格式系统日期的字符型日期
|
static int |
getYearOfDate(Date p_date)
获取指定日期的年份
|
static String |
getYesterdayOfDateByFormat(String p_format)
获取指定日期格式昨天的字符型日期
|
static Calendar |
toCalendarFromUtilDate(Date p_utilDate)
util.Date型日期转化转化成Calendar日期
|
static Date |
toSqlDateFromStrDate(String p_strDate)
字符型日期转化成sql.Date型日期
|
static Date |
toSqlDateFromUtilDate(Date p_utilDate)
util.Date型日期转化sql.Date(年月日)型日期
|
static Time |
toSqlTimeFromUtilDate(Date p_utilDate)
util.Date型日期转化sql.Time(时分秒)型日期
|
static Timestamp |
toSqlTimestampFromUtilDate(Date p_utilDate)
util.Date型日期转化sql.Date(时分秒)型日期
|
static String |
toStrDateFromUtilDateByFormat(Date p_utilDate,
String p_format)
util.Date型日期转化指定格式的字符串型日期
|
static Date |
toUtilDateFromSqlDate(Date p_sqlDate)
sql.Date型日期转化util.Date型日期
|
static Date |
toUtilDateFromStrDateByFormat(String p_strDate,
String p_format)
字符型日期转化util.Date型日期
|
dateTo14String, dateTo18String, dateToChineseString, formatDateToDHMSString, formatDateToHMSString, formatDateToMMddHHmm, formatDateToMysqlString, formatDateToyyMMddHHmm, formatTimestampToMysqlString, parseHMSStringToDate, parseStringToMysqlDate, parseStringToYMD, string14ToDatepublic static Calendar now
public static Date toUtilDateFromStrDateByFormat(String p_strDate, String p_format) throws ParseException
p_strDate - 字符型日期p_format - 格式:"yyyy-MM-dd" / "yyyy-MM-dd hh:mm:ss"ParseException - 转换异常public static Date toSqlDateFromStrDate(String p_strDate) throws ParseException
p_strDate - 字符型日期ParseException - 转换异常public static String toStrDateFromUtilDateByFormat(Date p_utilDate, String p_format) throws ParseException
p_utilDate - Datep_format - String 格式1:"yyyy-MM-dd"
格式2:"yyyy-MM-dd hh:mm:ss EE/yyyy-MM-dd HH:mm:ss EE"
格式3:"yyyy年MM月dd日 hh:mm:ss EE/yyyy年MM月dd日 HH:mm:ss EE" 说明:
年-月-日 时:分:秒 星期 注意MM/mm大小写ParseException - 转换异常public static Calendar toCalendarFromUtilDate(Date p_utilDate)
p_utilDate - Datepublic static Date toSqlDateFromUtilDate(Date p_utilDate)
p_utilDate - util.Date型日期public static Time toSqlTimeFromUtilDate(Date p_utilDate)
p_utilDate - util.Date型日期public static Timestamp toSqlTimestampFromUtilDate(Date p_utilDate)
p_utilDate - util.Date型日期public static Date toUtilDateFromSqlDate(Date p_sqlDate)
p_sqlDate - sql.Date型日期public static int getYearOfDate(Date p_date)
p_date - util.Date日期public static int getMonthOfDate(Date p_date)
p_date - util.Date日期public static int getDayOfDate(Date p_date)
p_date - util.Date日期public static int getHourOfDate(Date p_date)
p_date - util.Date日期public static int getMinuteOfDate(Date p_date)
p_date - util.Date日期public static int getSecondOfDate(Date p_date)
p_date - util.Date日期public static long getMillisOfDate(Date p_date)
p_date - util.Date日期public static String getNowOfDateByFormat(String p_format)
p_format - 日期格式 格式1:"yyyy-MM-dd" 格式2:"yyyy-MM-dd hh:mm:ss EE"
格式3:"yyyy年MM月dd日 hh:mm:ss EE" 说明: 年-月-日 时:分:秒 星期 注意MM/mm大小写public static String getStrTimeByUTC(long utc, String format)
utc - 指定的时间format - formatpublic static String getYesterdayOfDateByFormat(String p_format)
p_format - 日期格式 格式1:"yyyy-MM-dd" 格式2:"yyyy-MM-dd hh:mm:ss EE"
格式3:"yyyy年MM月dd日 hh:mm:ss EE" 说明: 年-月-日 时:分:秒 星期 注意MM/mm大小写public static String getSystemOfDateByFormat(String p_format)
p_format - 日期格式 格式1:"yyyy-MM-dd" 格式2:"yyyy-MM-dd hh:mm:ss EE"
格式3:"yyyy年MM月dd日 hh:mm:ss EE" 说明: 年-月-日 时:分:秒 星期 注意MM/mm大小写public static long getDayOfMonth(Date p_date) throws ParseException
p_date - dateParseException - 转换异常public static String getDateOfMonthBegin(String p_strDate, String p_format) throws ParseException
p_strDate - 指定月份p_format - 日期格式ParseException - 转换异常public static String getDateOfMonthEnd(String p_strDate, String p_format) throws ParseException
p_strDate - 指定月份p_format - 日期格式ParseException - 转换异常public static long getHoursOfTowDiffDate(String p_startDate, String p_endDate) throws Throwable
p_startDate - 起始时间p_endDate - 结束时间Throwable - 为知异常public static long getMinutesOfTowDiffDate(String p_startDate, String p_endDate) throws Throwable
p_startDate - 起始时间p_endDate - 结束时间Throwable - 为知异常public static long getSecondsOfTowDiffDate(String p_startDate, String p_endDate) throws Throwable
p_startDate - 起始时间p_endDate - 结束时间Throwable - 为知异常public static long getMillisOfTowDiffDate(String p_startDate, String p_endDate) throws Throwable
p_startDate - 起始时间p_endDate - 结束时间Throwable - 为知异常public static long getMillisOfTowDiffDate(Date p_startDate, Date p_endDate) throws Throwable
p_startDate - 起始时间p_endDate - 结束时间Throwable - 为知异常Copyright © 2017. All rights reserved.