`
gllwhq
  • 浏览: 14770 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

按格式取当前时间

阅读更多
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		
// 取当前时间
Date now = new Date();
Calendar cal = Calendar.getInstance();
DateFormat d2 = DateFormat.getDateTimeInstance();
String str2 = d2.format(now);

//String 转 Date类型
Date times=df.parse(str2)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics