public class Util extends Object
| 构造器和说明 |
|---|
Util() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Timestamp |
addTime(Timestamp start,
int year,
int month,
int day)
Adds the time.
|
static String |
checkTime(int id)
Check time.
|
static int |
compareDate(String d1,
String d2)
Compare date int.
|
static String |
dateAdd(String interval,
int number,
Date date)
Date add.
|
static int |
dateDiff(Date a,
Date b)
Date diff.
|
static Timestamp |
dateToSQLTimestamp(Date date)
Date to SQL timestamp.
|
static String |
formatDate(Date date)
Format date.
|
static String |
formatInteger(int i,
int j)
Format integer.
|
static String |
formatSDate(Date date)
Format S date.
|
static IConnectionPool |
getConnection()
Gets the connection.
|
static Timestamp |
getCurrentSQLTimestamp()
Gets the current SQL timestamp.
|
static int |
getDate(int curYear,
int curMonth,
int curDate)
Gets the date.
|
static String |
getDateString(long l,
String format)
Gets the date string.
|
static int |
getDiffYear(Timestamp start,
Timestamp end)
Gets the diff year.
|
static String |
getHeadIconPathById(int id)
Gets the head icon path by id.
|
static int |
getHour()
Gets the hour.
|
static String |
getLocalAddress()
Gets the local address.
|
static int |
getMinute()
Gets the minute.
|
static String |
getNowDate()
Gets the now date.
|
static String |
getNowDateTime()
Gets the now date time.
|
static String |
getNowTime()
Gets the now time.
|
static int |
getSecond()
Gets the second.
|
static Date |
getStrDate(String strX)
Gets the str date.
|
static String |
getString(Object o)
Gets the string.
|
static int |
getThisMonth()
Gets the this month.
|
static int |
getThisYear()
Gets the this year.
|
static int |
getToDayOfMonth()
Gets the to day of month.
|
static int |
getToWeekOfYear()
Gets the to week of year.
|
static void |
main(String[] args)
The main method.
|
static String |
randomDigital(int length)
Random digital.
|
static int |
randomNumber(int max)
Random number.
|
static String |
randomString(int length)
Returns a random String of numbers and letters (lower and upper case) of
the specified length.
|
static StringBuilder |
readFromFile(File source)
Read from file.
|
static Timestamp |
toSQLTimestamp(String time)
To SQL timestamp.
|
static void |
WriteStringToFile(String fn,
String dest)
Write string to file.
|
static String |
writeToFile(File source,
String dest)
Write to file.
|
public static IConnectionPool getConnection()
public static void WriteStringToFile(String fn, String dest)
fn - the fndest - the destpublic static String writeToFile(File source, String dest)
source - the sourcedest - the destpublic static StringBuilder readFromFile(File source)
source - the sourcepublic static String getLocalAddress()
public static String getHeadIconPathById(int id)
id - the idpublic static int getDiffYear(Timestamp start, Timestamp end)
start - the startend - the endpublic static Timestamp addTime(Timestamp start, int year, int month, int day)
start - the startyear - the yearmonth - the monthday - the daypublic static final Timestamp getCurrentSQLTimestamp()
public static final Timestamp toSQLTimestamp(String time)
time - the timepublic static Timestamp dateToSQLTimestamp(Date date)
date - the datepublic static String getNowTime()
public static String getNowDate()
public static String getNowDateTime()
public static int getThisYear()
public static int getThisMonth()
public static int getToDayOfMonth()
public static int getHour()
public static int getMinute()
public static int getSecond()
public static int getToWeekOfYear()
public static String formatDate(Date date)
date - the datepublic static String formatSDate(Date date)
date - the datepublic static String dateAdd(String interval, int number, Date date)
interval - the intervalnumber - the numberdate - the datepublic static int getDate(int curYear,
int curMonth,
int curDate)
curYear - the cur yearcurMonth - the cur monthcurDate - the cur datepublic static String checkTime(int id)
id - the idpublic static Date getStrDate(String strX)
strX - the str Xpublic static int compareDate(String d1, String d2)
d1 - the d 1d2 - the d 2public static String getDateString(long l, String format)
l - the lformat - the formatpublic static final String randomString(int length)
length - the desired length of the random String to return.public static final String randomDigital(int length)
length - the lengthpublic static final int randomNumber(int max)
max - the maxpublic static String formatInteger(int i, int j)
i - the ij - the jpublic static void main(String[] args)
args - the argumentsCopyright © 2018. All rights reserved.