Skip to content

Instantly share code, notes, and snippets.

@Blankj
Created September 8, 2017 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blankj/1d44de0fa5ffc35e1666d3804343b4db to your computer and use it in GitHub Desktop.
Save Blankj/1d44de0fa5ffc35e1666d3804343b4db to your computer and use it in GitHub Desktop.
[time_format] #Android

%tx 日期与时间类型(x代表不同的日期与时间转换符)

转 换 符 说 明 示 例
c 包括全部日期和时间信息 星期六 十月 27 14:21:20 CST 2007
F “年-月-日”格式 2007-10-27
D “月/日/年”格式 10/27/07
r “HH:MM:SS PM”格式(12时制) 02:25:51 下午
T “HH:MM:SS”格式(24时制) 14:28:16
R “HH:MM”格式(24时制) 14:28
H 2位数字24时制的小时(不足2位前面补0) 15
I 2位数字12时制的小时(不足2位前面补0) 03
k 2位数字24时制的小时(前面不补0) 15
l 2位数字12时制的小时(前面不补0) 3
M 2位数字的分钟(不足2位前面补0) 03
S 2位数字的秒(不足2位前面补0) 09
L 3位数字的毫秒(不足3位前面补0) 015
N 9位数字的毫秒数(不足9位前面补0) 562000000
p 小写字母的上午或下午标记 中:下午 英:pm
z 相对于GMT的RFC822时区的偏移量 +0800
Z 时区缩写字符串 CST
s 1970-1-1 00:00:00 到现在所经过的秒数 1193468128
Q 1970-1-1 00:00:00 到现在所经过的毫秒数 1193468128984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment