public final class DateTimeKit extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DATE_STYLE
yyyy-MM-dd
|
static String |
DATE_TIME_12HR_STYLE
yyyy-MM-dd hh:mm
|
static String |
DATE_TIME_24HR_STYLE
yyyy-MM-dd HH:mm
|
static String |
FULL_DATE_12HR_STYLE
yyyy-MM-dd hh:mm:ss
|
static String |
FULL_DATE_24HR_STYLE
yyyy-MM-dd HH:mm:ss
|
static String |
TIME_12HR_STYLE
hh:mm
|
static String |
TIME_24HR_STYLE
HH:mm
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Date |
dateStringToDate(String dateString)
时间转换
|
static int |
dayOfMonth()
某月的第几日
|
static int |
dayOfWeek()
某周的第几天
SUN = 7 MON = 1 TUE = 2 WED = 3
THU = 4 FRI = 5 SAT = 6
|
static int |
dayOfYear()
某年的第几天
|
static String |
formatDate(int style,
Date date)
格式化时间
|
static String |
formatDateToFull(Date date)
格式化时间为DateFormat.FULL风格的String => 2015年5月4日 星期一
|
static String |
formatDateToFULL12HRStyle(String spacer,
Date date)
格式化时间为Full12HR,使用spacer间隔。
|
static String |
formatDateToFULL24HRStyle(String spacer,
Date date)
格式化时间为Full24HR,使用spacer间隔。
|
static String |
formatDateToHRStyle(org.openingo.jdkits.date.DateTimeKit.HR hr,
Date date)
格式化日期为时间格式
|
static String |
formatDateToMedium(Date date)
格式化时间为DateFormat.MEDIUM风格的String => 2015-5-4
|
static String |
formatDateToShort(Date date)
格式化时间为DateFormat.SHORT风格的String => 15-5-4
|
static String |
formatDateToStyle(String style,
Date date)
格式化时间
|
static String |
formatNow(int style)
格式化时间
|
static String |
formatNowToFull()
格式化当前时间为DateFormat.FULL风格的String => 2015年5月4日 星期一
|
static String |
formatNowToFULL12HRStyle(String spacer)
格式化当前时间为Full12HR,使用spacer间隔。
|
static String |
formatNowToFULL24HRStyle(String spacer)
格式化当前时间为Full24HR,使用spacer间隔。
|
static String |
formatNowToHRStyle(org.openingo.jdkits.date.DateTimeKit.HR hr)
格式化当前日期为时间格式
|
static String |
formatNowToMedium()
格式化当前时间为DateFormat.MEDIUM风格的String => 2015-5-4
|
static String |
formatNowToShort()
格式化当前时间为DateFormat.SHORT风格的String => 15-5-4
|
static String |
formatNowToStyle(String style)
格式化时间
|
static String |
formatUnixTime(String style,
BigInteger unixtime)
格式化时间戳为制定的style
|
static String |
formatUnixTimeTo12HRStyle(BigInteger unixtime)
格式化时间戳为制定的12hour style
|
static String |
formatUnixTimeTo24HRStyle(BigInteger unixtime)
格式化时间戳为制定的24hour style
|
static Date |
formatUnixTimeToDate(BigInteger unixtime)
BigInteger 转Date
|
static String |
formatUnixTimeToShort12HRStyle(BigInteger unixtime)
格式化时间戳为制定的short 12hour style
|
static String |
formatUnixTimeToShort24HRStyle(BigInteger unixtime)
格式化时间戳为制定的short 24hour style
|
static Long |
getCurrentUnixTime()
获取当前的时间的UnixTime
|
static Long |
getMonday()
获取给定时间的周一的长整形表示
|
static Long |
getMonth1stDay()
获取本月的第一天的时间戳
|
static Long |
getMonthLastDay()
获取本月的最后一天的时间戳
|
static Long |
getSunday()
获取给定时间的周日的长整形表示
|
static Long |
getUnixTimeAfterDay(int day)
获取day天之后的UnixTime
|
static Long |
getUnixTimeBeforeDay(int day)
获取day天之前的UnixTime
|
static BigInteger |
getUnixTimeMillis(BigInteger time)
把time转为 unix time 到毫秒
|
static BigInteger |
getUnixTimeMillis(Long time)
把time转为 unix time 到毫秒
|
static int |
month()
月
|
static int |
year()
年
|
public static final String FULL_DATE_24HR_STYLE
public static final String FULL_DATE_12HR_STYLE
public static int year()
public static int month()
public static int dayOfMonth()
public static int dayOfYear()
public static int dayOfWeek()
public static String formatDate(int style, Date date)
style - date - DateFormatpublic static String formatNow(int style)
style - DateFormatpublic static String formatDateToFull(Date date)
date - public static String formatNowToFull()
public static String formatDateToMedium(Date date)
date - public static String formatNowToMedium()
public static String formatDateToShort(Date date)
date - public static String formatNowToShort()
public static String formatDateToStyle(String style, Date date)
style - 格式风格date - public static String formatDateToFULL24HRStyle(String spacer, Date date)
spacer - 间隔号date - public static String formatNowToFULL24HRStyle(String spacer)
spacer - 间隔号public static String formatDateToFULL12HRStyle(String spacer, Date date)
spacer - 间隔号date - public static String formatNowToFULL12HRStyle(String spacer)
spacer - 间隔号public static String formatDateToHRStyle(org.openingo.jdkits.date.DateTimeKit.HR hr, Date date)
hr - date - public static String formatNowToHRStyle(org.openingo.jdkits.date.DateTimeKit.HR hr)
hr - public static String formatUnixTime(String style, BigInteger unixtime)
style - unixtime - public static String formatUnixTimeToShort24HRStyle(BigInteger unixtime)
unixtime - public static String formatUnixTimeTo24HRStyle(BigInteger unixtime)
unixtime - public static String formatUnixTimeToShort12HRStyle(BigInteger unixtime)
unixtime - public static String formatUnixTimeTo12HRStyle(BigInteger unixtime)
unixtime - public static Date formatUnixTimeToDate(BigInteger unixtime)
unixtime - public static Long getMonth1stDay()
public static Long getMonthLastDay()
public static Long getMonday()
public static Long getSunday()
public static Long getUnixTimeAfterDay(int day)
day - public static Long getUnixTimeBeforeDay(int day)
day - public static Long getCurrentUnixTime()
public static BigInteger getUnixTimeMillis(BigInteger time)
time - public static BigInteger getUnixTimeMillis(Long time)
time - Copyright © 2021. All rights reserved.