常用关系对照表
y 年
M 月
d 日
H 小时
m 分钟
s 秒
不常用
D 年中的天数
h AM/PM中的小时数
a AM/PM标记
S 毫秒
Z 时区
AM=上午 PM=下午
使用java.text.SimpleDateFormat中的format 方法将Date格式转换为字符串
使用parse方法将字符串解析为Date格式,解析失败则抛出ParseException。
常用关系对照表
y 年
M 月
d 日
H 小时
m 分钟
s 秒
不常用
D 年中的天数
h AM/PM中的小时数
a AM/PM标记
S 毫秒
Z 时区
AM=上午 PM=下午
使用java.text.SimpleDateFormat中的format 方法将Date格式转换为字符串
使用parse方法将字符串解析为Date格式,解析失败则抛出ParseException。