자바format

2013. 7. 26. 13:37WEB/JSP(JAVA)



반응형

 

 

이건뭐 매일 해깔리 외우지지도 않음 그냥 매일 찾아다녀아함;

java format 형식

 

ex)

GregorianCalendar calendar = new GregorianCalendar(Locale.KOREA);

 

System.out.println("Date="+String.format("%tF",calendar));

 

 

 

ta Localized weekday name (abbreviated). format("%ta", cal, cal); Tue
tA Localized weekday name (full). format("%tA", cal, cal); Tuesday
tb Localized month name (abbreviated). format("%tb", cal); Apr
tB Localized month name (full). format("%tB", cal); April
tc C library asctime(3)-like output. Do not use. format("%tc", cal); Tue Apr 01 16:19:17 CEST 2008
tC 2-digit century. format("%tC", cal); 20
td 2-digit day of month (01-31). format("%td", cal); 01
tD Ambiguous US date format (MM/DD/YY). Do not use. format("%tD", cal); 04/01/08
te Day of month (1-31). format("%te", cal); 1
tF Full date in ISO 8601 format (YYYY-MM-DD). format("%tF", cal); 2008-04-01
th Synonym for %tb.
tH 2-digit 24-hour hour of day (00-23). format("%tH", cal); 16
tI 2-digit 12-hour hour of day (01-12). format("%tI", cal); 04
tj 3-digit day of year (001-366). format("%tj", cal); 092
tk 24-hour hour of day (0-23). format("%tk", cal); 16
tl 12-hour hour of day (1-12). format("%tl", cal); 4
tL Milliseconds. format("%tL", cal); 359
tm 2-digit month of year (01-12). format("%tm", cal); 04
tM 2-digit minute. format("%tM", cal); 08
tN Nanoseconds. format("%tN", cal); 359000000
tp a.m. or p.m. format("%tp %Tp", cal, cal); pm PM
tQ Milliseconds since the epoch. format("%tQ", cal); 1207059412656
tr Full 12-hour time (%tI:%tM:%tS %Tp). format("%tr", cal); 04:15:32 PM
tR Short 24-hour time (%tH:%tM). format("%tR", cal); 16:15
ts Seconds since the epoch. format("%ts", cal); 1207059412
tS 2-digit seconds (00-60). format("%tS", cal); 17
tT Full 24-hour time (%tH:%tM:%tS). format("%tT", cal); 16:15:32
ty 2-digit year (00-99). format("%ty", cal); 08
tY 4-digit year. format("%tY", cal); 2008
tz Time zone GMT offset. format("%tz", cal); +0100
tZ Localized time zone abbreviation. format("%tZ", cal); CEST

 

source : http://developer.android.com/reference/java/util/Formatter.html

반응형

'WEB > JSP(JAVA)' 카테고리의 다른 글

자바 달력  (2) 2013.08.08
자바 소수 반올림  (0) 2013.08.07
자바 랜덤함수 (Random)  (0) 2013.07.09
자바 StringTokenizer  (0) 2013.07.08
자바 try catch  (0) 2013.07.05