device代码添加字段

This commit is contained in:
2023-08-04 09:26:26 +08:00
parent 13d5d73ce1
commit 310b4c64a8
3 changed files with 26 additions and 1 deletions

View File

@@ -92,6 +92,24 @@ public class PubUtils {
return bf.format(new Date());
}
/**
* 毫秒转时间 ms:需要转换的毫秒时间
*/
public static Date ms2Date(Long ms) {
Calendar c = Calendar.getInstance();
c.setTimeInMillis(ms);
return c.getTime();
}
/**
* 日期转字符串函数 date:需要转换的日期 strFormat:转换的格式(yyyy-MM-dd HH:mm:ss)
*/
public static String date2String(Date date, String strFormat){
SimpleDateFormat format = new SimpleDateFormat(strFormat);
return format.format(date);
}
/**
* 获取当前web的IP
*/