开发者

How parse this 2009-05-12T13:40:00Z to java date [duplicate]

开发者 https://www.devze.com 2023-01-30 15:16 出处:网络
This question already has answers here: What's the best way to 开发者_JS百科parse an XML dateTime in Java?
This question already has answers here: What's the best way to 开发者_JS百科parse an XML dateTime in Java? (9 answers) Closed 6 years ago.

what's the best way to parse this string 2009-05-12T13:40:00Z to a valid java date? I'm not sure for what "T" and "Z" stands for - i guess Z means zulu?

Thanks, Joo


The format string you have is a UTC date/time in the ISO 8601 format. The format is simply the date, a T separator and the UTC time (or zulu time).

java.text.SimpleDateFormatter should perform all the parsing you need.


Note that the patter has some special handling for internal static values like 'T':

See the answer here Illegal pattern character 'T' when parsing a date string to java.util.Date

0

精彩评论

暂无评论...
验证码 换一张
取 消