/**
* 获取当前时间的时分秒
* @return
*/
public long getHms() {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String hms=sdf.format(new Date());
String[] split = hms.split(":");
long time = Integer.parseInt(split[0]) * 60 * 60 * 1000 + Integer.parseInt(split[1]) * 60 * 1000 + Integer.parseInt(split[2]) * 1000;
return time;
}
将当前long型的仅有年月日的日期拼成既有年月日,又有时分秒的格式:
long currentTime=15230110000;(2018-02-06 00:00:00)
long time=gteHms();
long newDate=currentTime + time
return 2018-02-06 13:34:07
* 获取当前时间的时分秒
* @return
*/
public long getHms() {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String hms=sdf.format(new Date());
String[] split = hms.split(":");
long time = Integer.parseInt(split[0]) * 60 * 60 * 1000 + Integer.parseInt(split[1]) * 60 * 1000 + Integer.parseInt(split[2]) * 1000;
return time;
}
将当前long型的仅有年月日的日期拼成既有年月日,又有时分秒的格式:
long currentTime=15230110000;(2018-02-06 00:00:00)
long time=gteHms();
long newDate=currentTime + time
return 2018-02-06 13:34:07
692

被折叠的 条评论
为什么被折叠?



