java获取时间格式
public static Timestamp getDate(){
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd hhss”);
Timestamp time = Timestamp.valueOf(sdf.format(new Date()));
return time;
}
public static void main(String[] args) {
Timestamp t = getDate();
System.out.println(t.toString());
}
还没有评论,来说两句吧...