package cn.javass.common.format;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class FormatUtil {
private FormatUtil(){
}
public static String formatDate(long time,String formatStr){
if(formatStr==null || formatStr.trim().length()==0){
formatStr = "yyyy-MM-dd HH:mm:ss";
}
DateFormat df = new SimpleDateFormat(formatStr);
return df.format(new Date(time));
}
public static long formateDateStringToLong(String dateStr,String formatStr){
if(formatStr==null || formatStr.trim().length()==0){
formatStr = "yyyy-MM-dd HH:mm:ss";
}
DateFormat df = new SimpleDateFormat(formatStr);
try {
return df.parse(dateStr).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
return 0L;
}
}
最近下载更多
huangtian LV3
2023年7月11日
lsq54365 LV14
2022年6月20日
没朋友的键盘侠 LV8
2022年5月19日
zzfzzf LV7
2022年4月22日
tangjj7260 LV18
2021年12月25日
guaixia163 LV13
2021年12月21日
heihus LV3
2021年9月6日
yangsha868 LV9
2021年8月13日
MarkLee 琥珀川 LV13
2021年7月21日
above-null LV1
2021年3月22日
最近浏览更多
yidongdematong LV2
6月12日
gann2015 LV25
6月4日
不错不
2024年10月10日
暂无贡献等级
lqzixi LV4
2024年10月9日
allknow2008
2024年7月31日
暂无贡献等级
lun123456
2024年6月22日
暂无贡献等级
微信网友_6790506018131968 LV1
2024年1月1日
XNDIC522
2023年11月6日
暂无贡献等级
weilaizhisheng LV21
2023年9月28日
huangtian LV3
2023年7月11日

