admin管理员组

文章数量:1532380

2024年6月9日发(作者:)

* @return

*/

public static String getTimeShort() {

SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");

Date currentTime = new Date();

String dateString = (currentTime);

return dateString;

}

/**

* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss

*

* @param strDate

* @return

*/

public static Date strToDateLong(String strDate) {

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

ParsePosition pos = new ParsePosition(0);

Date strtodate = (strDate, pos);

return strtodate;

}

/**

* 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss

*

* @param dateDate

* @return

*/

public static String dateToStrLong( dateDate) {

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

String dateString = (dateDate);

return dateString;

}

/**

* 将短时间格式时间转换为字符串 yyyy-MM-dd

*

* @param dateDate

* @param k

* @return

*/

public static String dateToStr( dateDate) {

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

String dateString = (dateDate);

return dateString;

}

/**

* 将短时间格式字符串转换为时间 yyyy-MM-dd

*

* @param strDate

* @return

*/

public static Date strToDate(String strDate) {

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

ParsePosition pos = new ParsePosition(0);

Date strtodate = (strDate, pos);

return strtodate;

}

/**

* 得到现在时间

*

* @return

*/

public static Date getNow() {

Date currentTime = new Date();

return currentTime;

}

本文标签: 转换格式时间