자바 7에서 ISO 8601 을 지원한다.

http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html



LetterDate or Time ComponentPresentationExamples
zTime zoneGeneral time zonePacific Standard TimePSTGMT-08:00
ZTime zoneRFC 822 time zone-0800
XTime zoneISO 8601 time zone-08-0800-08:00


    val dateFormat : DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")

    val iso8601String : String = "2014-12-03T20:27:57+09:00"

    val dateFormatString : Date = dateFormat.parse(iso8601String)


    println(dateFormatString)



결과


Wed Dec 03 20:27:57 KST 2014



그외에도 RFC 822도 지원한다. 


Posted by '김용환'
,