public class DateTimeHelper extends Object
| 构造器和说明 |
|---|
DateTimeHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
dateDiff(String interval,
Date StartDate,
Date EndDate)
Returns the number of intervals between two dates.
|
static String |
getNowString()
Convert Date Now to string
|
static boolean |
isDate(String str)
Checks if the string can be converted into Date or not
|
static boolean |
isSameDay(String str1,
String str2)
Checks if two strings can be converted into Date are on the same day
ignoring time.
|
static boolean |
isSameInstant(String str1,
String str2)
Checks if two strings can be converted into Date are the same instant in
time.
|
static Date |
now()
Get Date Now
|
static Date |
toDate(String date)
Convert string to corresponding date format
|
static Date |
toDate(String date,
String sDateFormat)
Convert string to corresponding date format
|
static Date |
toDateTime(String date)
Convert string to corresponding date format
|
static Date |
toDateTime(String date,
String sDateFormat)
Convert string to corresponding date format
|
static void |
wait(Double Second)
Wait specified second
|
static void |
wait(int intSecond)
Wait specified second
|
public static Date toDate(String date, String sDateFormat)
date - string date to be convertedsDateFormat - specific date formatpublic static Date toDate(String date)
date - string date to be convertedpublic static boolean isDate(String str)
str - the first string can be converted into Datepublic static boolean isSameDay(String str1, String str2)
str1 - the first string can be converted into Datestr2 - the second string can be converted into Datepublic static Date toDateTime(String date, String sDateFormat)
date - string date to be convertedsDateFormat - specific date formatpublic static Date toDateTime(String date)
date - string date to be convertedpublic static boolean isSameInstant(String str1, String str2)
str1 - the first string can be converted into Datestr2 - the second string can be converted into Datepublic static String getNowString()
public static Date now()
public static void wait(Double Second)
Second - Doublepublic static void wait(int intSecond)
intSecond - intpublic static int dateDiff(String interval, Date StartDate, Date EndDate)
interval - The interval you want to use to calculate the differences between StartDate and EndDate Can take the following values: d - Day h - Hour n - Minute s - SecondStartDate - the start dateEndDate - the end dateCopyright © 2017. All rights reserved.