标签:
public static void main(String[] args) {
String pattern = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat format = new SimpleDateFormat(pattern);
String curDate = format.format(new Date());
System.out.println(curDate);
}
| 字母 | 日期或时间元素 | 表示 | 示例 |
| G | Era 标志符 | AD | |
| y | 年 | 1996 ; 96 | |
| M | 年中的月份 | July ; Jul ; 07 | |
| w | 年中的周数 | 27 | |
| W | 月份中的周数 | 2 | |
| D | 年中的天数 | 189 | |
| d | 月份中的天数 | 10 | |
| F | 月份中的星期 | 2 | |
| E | 星期中的天数 | Tuesday ; Tue | |
| a | Am/pm 标记 | PM | |
| H | 一天中的小时数(0-23) | 0 | |
| k | 一天中的小时数(1-24) | 24 | |
| K | am/pm 中的小时数(0-11) | 0 | |
| h | am/pm 中的小时数(1-12) | 12 | |
| m | 小时中的分钟数 | 30 | |
| s | 分钟中的秒数 | 55 | |
| S | 毫秒数 | 978 | |
| z | 时区 | Pacific Standard Time ; PST ;GMT-08:00 | |
| Z | 时区 | -0800 |
标签:
原文地址:http://www.cnblogs.com/study121007/p/4592724.html