发布于 

java,获取当前时间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.example.rcadmin.commonutils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class timeUtil {
public static Date getcurtime() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss ");
Date ctime = null;
try {
ctime = sdf.parse(sdf.format(new Date()));
} catch (ParseException e) {
e.printStackTrace();
}
return ctime;
}
}