public class DateUtils extends Object
| Constructor and Description |
|---|
DateUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
dateToStr(Date date,
String dateFormat)
将Date类型转换为字符型
|
static String |
getAnyDay(String dateFormat,
int interval)
获取当前时间任意间隔天数
|
static String |
getCurrentDay()
获取当前天
|
static String |
getCurrentHour()
获取当前小时
|
static String |
getCurrentMonth()
获取当前月
|
static String |
getCurrentYear()
获取当前年
|
static int |
getTimeDiff(Date smTime,
Date bigTime)
计算时间相差的天数
|
static int |
getTimeDiffExactDay(String smTime,
String bigTime)
计算时间相差天数
|
static int |
getTimeDiffExactSec(String smTime,
String bigTime)
计算时间相差天数
|
static int |
getTimeDiffStr(String smTime,
String bigTime,
String dateFormat)
计算时间相差天数
|
static String |
getToday(String dateFormat)
获取当前系统时间
|
static String |
getTodayExactDayChar()
获取当前时间
|
static String |
getTodayExactMilliSecond()
获取当前时间精确到毫秒
|
static String |
getTodayExactSec()
获取当前时间
|
static String |
getTodayExactSecChar()
获取当前时间
|
static String |
getTodyExactDay()
获取当前时间
|
static Date |
stringToDate(String date,
String dateFormat)
字符串时间转为Date类型
|
static Date |
strToDateExactDay(String date)
将String 转为Date型
|
static Date |
strToDateExactSec(String date)
带时分秒的String时间转为Date
|
public static Date strToDateExactDay(String date)
date - 字符串时间 yyyy-MM-ddpublic static Date strToDateExactSec(String date)
date - 字符串时间yyyy-MM-dd HH:mm:sspublic static Date stringToDate(String date, String dateFormat)
date - 时间dateFormat - 转换格式public static String getCurrentYear()
public static String getCurrentMonth()
public static String getCurrentDay()
public static String getCurrentHour()
public static String getTodayExactMilliSecond()
public static String getTodayExactDayChar()
public static String getTodayExactSecChar()
public static String getTodyExactDay()
public static String getTodayExactSec()
public static String getToday(String dateFormat)
dateFormat - 时间格式public static String getAnyDay(String dateFormat, int interval)
dateFormat - 时间格式interval - 间隔天数public static int getTimeDiff(Date smTime, Date bigTime)
smTime - 较小的时间bigTime - 较大的时间public static int getTimeDiffStr(String smTime, String bigTime, String dateFormat)
smTime - 较小时间bigTime - 较大时间dateFormat - 时间格式public static int getTimeDiffExactDay(String smTime, String bigTime)
smTime - 较小时间精确到天bigTime - 较大时间精确到天public static int getTimeDiffExactSec(String smTime, String bigTime)
smTime - 较小时间精确到秒bigTime - 较大时间精确到秒Copyright © 2021. All rights reserved.