您的位置:首页 > 编程语言 > Java开发

java 常用时间格式

2010-10-21 23:53 337 查看
日历表的方式

Calendar now = Calendar.getInstance();
String time = now.get(Calendar.YEAR) + "-"
+ (now.get(Calendar.MONTH) + 1) + "-"
+ now.get(Calendar.DAY_OF_MONTH) + " "
+ now.get(Calendar.HOUR_OF_DAY) + ":"
+ now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND);

简单的时间格式

SimpleDateFormat formate=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String nowDate=formate.format(new Date());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: