<>@JsonFormat Set the time string 2021-02-25T15:32:54+08:00 Analysis into date

Due to docking hardware , Hardware returned json In string , The string with time field is 2021-02-25T15:32:54+08:00,UTC( World coordinated time format ), Then crazy Baidu , See how to utc Time conversion of format to DATE, Then I see that the big guys on the Internet mostly use the following ways
System.Globalization.CultureInfo("en-us")); DateFormat df = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); //yyyy-MM-dd'T'HH:mm:ss.SSSZ
Date date = df.parse(oldDateStr);
But because I use the entity class as the json Receiving object , I don't want to do secondary conversion , Then I wonder if I can be lazy , Direct use fastjson Of
@JsonFormat How about time formatting , Since the previous parsing is in the normal format, the following is true
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
So it imitates the time format , Isn't that the middle one T I'll add that, too
@JsonFormat(pattern = "yyyy-MM-ddTHH:mm:ss",timezone = "GMT+8")

Added T After that, the analysis is decisive and no error is reported , There was a twinge of joy in my heart , However, the output time is used for verification , Direct resolution exception , Then the crazy Baidu failed , But don't give up , Clearly can be resolved, why the output will report an error , A sudden idea , Refer to the article of a brother in the blog Garden new
It's in the time format T A single quotation mark is added , Do what you say , I also added single quotation marks and the result is as follows
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss",timezone = "GMT+8")
Decisive transformation success , The clever one stole a lazy one , happy
The test output is as follows :
System.out.println(testDate.getCeshi());// result :Thu Feb 25 15:32:54 CST 2021
System.out.println(testDate.getCeshi().getTime());// result :1614238374000

©2019-2020 Toolsou All rights reserved,
Hikvision - Embedded software written test questions C Language application 0 The length of array in memory and structure is 0 In depth analysis data structure --- The preorder of binary tree , Middle order , Subsequent traversal How to do it ipad Transfer of medium and super large files to computer elementui Shuttle box el-transfer Display list content text too long 2019 The 10th Blue Bridge Cup C/C++ A Summary after the National Games ( Beijing Tourism summary )unity Shooting games , Implementation of first person camera python of numpy Module detailed explanation and application case Study notes 【STM32】 Digital steering gear Horizontal and vertical linkage pan tilt Vue Used in Element Open for the first time el-dialog Solution for not getting element