Java Transit UTC time String (contains T Z) for local time

Source: Internet
Author: User
Tags local time

In Java we need to convert the string in the appropriate format, and many times we think of using the SimpleDateFormat class to parse it. But recently, when I called a third-party interface, there was a expires field in the JSON string that returned the value of 2014-08-24t09:27:42z. The first reaction must be associated with the time zone. So how do you parse it into a date class?

SimpleDateFormat df = new SimpleDateFormat ("Yyyy-mm-dd ' T ' HH:mm:ss ' Z '");d F.settimezone (Timezone.gettimezone ("UTC")) ; System.out.println (Df.parse ("2014-08-23t09:20:05z"). toString ());

Now look at the printed information you asked for, right? The title of the blog contains the two keywords TZ, mainly for the convenience of others to search, because many people do not know that this is UTC time AH. This next people search TZ may be able to search this blog.

Java Transit UTC time String (contains T Z) for local time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.