[Android] Simple Date Format format pattern list

List of format patterns in the argument pattern of SimpleDateFormat (String pattern)

A slightly easier-to-understand version of the Android API Reference An example is July 8, 2017 20:11:58 Locale.JAPAN

letter Description Example
G A.D. Year
y Year yyyy = 2017
yy = 17
M Month MMMM =July
MMM =July
MM = 07
M = 7
w Week number(Against the year) 27
W Week number(Against the moon) 2
D Day(Against the year) 189
d Day(Against the moon) 08
F aligned 2
E Day of the week soil
u(*) Day of the week number( 1 =Monday, ... , 7 =Sunday) 6
a AM / PM afternoon
H time( 0 - 23 ) 20
k time( 1 - 24 ) 20
K AM /PM time( 0 - 11 ) 8
h AM /PM time( 1 - 12 ) 8
m Minutes 11
s Seconds 58
S millisecond 4960
z Time zone(General time zone) JST
Z Time zone(RFC 822 time zone) +0900
 G,yyyy,yy,MMMM,MMM,MM,M,w,W,D,dd,d,F,E,a,H,k,K,h,mm,m,ss,SSSS,z,Z

Where you specified

Year,2017,17,July,July,07,7,27,2,189,08,8,2,soil,afternoon,20,20,8,8,11,11,58,4960,JST,+0900 

Was returned It is a table based on the result Since it was API21, the u example is a guess ~~ Troublesome to move the simulator ~~

For Y and X

Unknown pattern character 'X'
Unknown pattern character 'Y'

I couldn't get it If anyone knows anything, please let me know

Also, since this is the first output in such a place, I would appreciate it if you could comment if there are any points that cannot be reached. Please make it full bocco

Source: Android Developers Reference SimpleDateFormat

Postscript

When I checked the reference now, It seems that it was an API level problem that the X and Y values could not be obtained.

That's why you should run the emulator at all

Recommended Posts

[Android] Simple Date Format format pattern list
Customize list view on Android
[Java] Draw a simple pattern