If you like, you can add group number :913934649
Public class DateUtil {/** * get the system timestamp * @return
*/
public long getCurTimeLong(){
long time=System.currentTimeMillis();
returntime; } /** * get the current time * @param pattern * @return
*/
public static String getCurDate(String pattern){
SimpleDateFormat sDateFormat = new SimpleDateFormat(pattern);
returnsDateFormat.format(new java.util.Date()); } /** * the timestamp is converted to the character channel@param milSecond * @param pattern * @return
*/
public static String getDateToString(long milSecond, String pattern) {
Date date = new Date(milSecond);
SimpleDateFormat format = new SimpleDateFormat(pattern);
returnformat.format(date); } /** * convert a string to a timestamp * @param dateString * @param pattern * @return
*/
public static long getStringToDate(String dateString, String pattern) {
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
Date date = new Date();
try{
date = dateFormat.parse(dateString);
} catch(ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
returndate.getTime(); }}Copy the code