| 分类 | 语法 | 解释 | 示例 |
| y-year | yyyy | full year number. | 2015 |
| yy | two-digit year. | 15 | |
| M-month of the year | M | minimal-digit month. | 1 |
| MM | two-digit month. | 01 | |
| MMM | two-digit month. zero-padded if needed. | Jan | |
| MMMM | abbreviated month text. | January | |
| d-day of the month | d | minimal-digit day. | 1 |
| dd | two-digit day, zero-padded if needed. | 01 | |
| H-hour of the day (24-hour clock) | H | minimal-digit hour. | 0 |
| HH | two-digit hour, zero-padded if needed. | 00 | |
| m-minutes of the hour (60 minutes per hour) | m | minimal-digit minutes. | 0 |
| mm | two-digit minutes, zero-padded if needed. | 00 | |
| s-seconds of the minute (60 seconds per minute) | s | minimal-digit seconds. | 0 |
| ss | two-digit seconds, zero-padded if needed. | 00 | |
| S-fraction of a second Maximum precision is milliseconds (SSS). Beyond that, zeroes are appended. | S | tenths of a second. | 0 |
| SS | hundredths of a second. | 01 | |
| SSS | thousandths of a second. | 012 | |
| Z-time zone offset or identity | Z | Timezone offset structured as HHmm. | -0700 |
| ZZ | Timezone offset structured as HH:mm. | -07:00 | |
| ZZZ | Timezone identity. | America/Los_Angeles | |
| w-week of the year | w | minimal-digit week. | 1 |
| ww | two-digit week, zero-padded if needed. | 01 | |
| D-day of the year | |||
| e-day of the week (number) | |||
| E-day of the week (text) | E, EE, EEE | Abbreviated day of the week. | Mon |
| EEEE | The full text day of the week. | Monday | |
| 备注:For non-formatting syntax, you’ll need to put single-quote characters around the value. For example, if you were parsing ISO8601 time, "2015-01-01T01:12:23" that little "T" isn’t a valid time format, and you want to say "literally, a T", your format would be this: "yyyy-MM-dd’T’HH:mm:ss" Other less common date units, such as era (G), century (C), am/pm (a), and # more, can be learned about on the joda-time documentation. | |||
时间戳解析
日期时间格式详解
最新推荐文章于 2025-08-21 10:02:14 发布
7652

被折叠的 条评论
为什么被折叠?



