{"id":341,"date":"2020-04-14T14:51:31","date_gmt":"2020-04-14T06:51:31","guid":{"rendered":"https:\/\/blog.humh.cn\/?p=341"},"modified":"2020-04-14T14:51:32","modified_gmt":"2020-04-14T06:51:32","slug":"%e5%85%b3%e4%ba%8e%e4%bb%a3%e7%a0%81%e4%b8%ad%e6%97%b6%e5%8c%ba%e4%bd%bf%e7%94%a8%e6%97%b6%e7%9a%84%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/blog.humh.cn\/?p=341","title":{"rendered":"\u5173\u4e8e\u4ee3\u7801\u4e2d\u65f6\u533a\u4f7f\u7528\u65f6\u7684\u6ce8\u610f\u4e8b\u9879"},"content":{"rendered":"\n<p>\u5bf9\u4e8ejdk\u672c\u8eab\u7684SimpleDateFormat\u6216commons-lang\u5305\u4e2d\u7684DateFormatUtils\u7b49\uff0c\u5982\u679c\u4e0d\u663e\u793a\u6307\u5b9aTimeZone\uff0c\u5219\u4f1a\u4f7f\u7528\u9ed8\u8ba4\u7684timeZone\uff0c\u901a\u8fc7jvm\u53bb\u83b7\u53d6\u64cd\u4f5c\u7cfb\u7edf\u6240\u5728\u65f6\u533a\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/file.blog.humh.cn\/2020\/04\/\u56fe\u7247-6.png\"><img width=\"536\" height=\"465\" class=\"wp-image-342 lazyload\" title=\"\u5173\u4e8e\u4ee3\u7801\u4e2d\u65f6\u533a\u4f7f\u7528\u65f6\u7684\u6ce8\u610f\u4e8b\u9879\" src=\"data:image\/gif;base64,R0lGODlhAgABAIAAALGxsQAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw==\" data-src=\"https:\/\/file.blog.humh.cn\/2020\/04\/\u56fe\u7247-6.png\" alt=\"https:\/\/file.blog.humh.cn\/2020\/04\/\u56fe\u7247-6.png\" data-srcset=\"https:\/\/file.blog.humh.cn\/wp-content\/uploads\/2020\/04\/\u56fe\u7247-6.png 536w, https:\/\/file.blog.humh.cn\/wp-content\/uploads\/2020\/04\/\u56fe\u7247-6-300x260.png 300w\" sizes=\"(max-width: 536px) 100vw, 536px\"><\/a><\/figure><\/div>\n\n\n\n<p>\u4f46\u662f\u5bf9\u4e8e\u90e8\u5206\u5de5\u5177\uff0c\u5e76\u4e0d\u662f\u8fd9\u6837\uff0c\u5b83\u7684\u9ed8\u8ba4\u65f6\u533a\u5e76\u4e0d\u662f\u91c7\u7528\u64cd\u4f5c\u7cfb\u7edf\u6240\u5728\u65f6\u533a\u3002<br>\u5982\uff1aSpringMVC\u9ed8\u8ba4JSON\u5e8f\u5217\u5316\u91c7\u7528jackson\uff0c\u5176\u4e2d\u5bf9\u4e8eDate\u8fd9\u79cd\u65f6\u95f4\u7c7b\u578b\u5b57\u6bb5\uff0c\u652f\u6301\u683c\u5f0f\u5316\u8f93\u51fa\uff0c\u53ea\u9700\u8981\u5728\u5b57\u6bb5\u4e0a\u6807\u8bb0<code>@JsonFormat<\/code>\u6ce8\u89e3\uff0c\u5b9a\u4e49pattern\u5373\u53ef\u3002\u5176\u4e2d\u5b83\u53ef\u4ee5\u6307\u5b9atimeZone\uff0c\u5982\u679c\u6ca1\u6709\u663e\u793a\u6307\u5b9a\u65f6\u533a\u7684\u8bdd\uff0c\u4ed6\u4f1a\u91c7\u7528\u9ed8\u8ba4\u65f6\u533a\uff0c<strong>\u4f46\u8fd9\u91cc\u7684\u9ed8\u8ba4\u65f6\u533a\u5e76\u4e0d\u50cf\u5927\u591a\u6570\u65f6\u95f4\u5de5\u5177\u4e00\u6837\uff0c\u901a\u8fc7jvm\u83b7\u53d6\u64cd\u4f5c\u7cfb\u7edf\u65f6\u533a\uff01\uff01<\/strong>\u5982\u4e0b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/file.blog.humh.cn\/2020\/04\/\u56fe\u7247-7.png\"><img width=\"728\" height=\"417\" class=\"wp-image-343 lazyload\" title=\"\u5173\u4e8e\u4ee3\u7801\u4e2d\u65f6\u533a\u4f7f\u7528\u65f6\u7684\u6ce8\u610f\u4e8b\u9879\" src=\"data:image\/gif;base64,R0lGODlhAgABAIAAALGxsQAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw==\" data-src=\"https:\/\/file.blog.humh.cn\/2020\/04\/\u56fe\u7247-7.png\" alt=\"https:\/\/file.blog.humh.cn\/2020\/04\/\u56fe\u7247-7.png\" data-srcset=\"https:\/\/file.blog.humh.cn\/wp-content\/uploads\/2020\/04\/\u56fe\u7247-7.png 728w, https:\/\/file.blog.humh.cn\/wp-content\/uploads\/2020\/04\/\u56fe\u7247-7-300x172.png 300w\" sizes=\"(max-width: 728px) 100vw, 728px\"><\/a><figcaption>JsonFormat doc<\/figcaption><\/figure><\/div>\n\n\n\n<p>doc\u4e2d\u63cf\u8ff0\u5f88\u6e05\u695a\uff0c\u9ed8\u8ba4\u5e76\u4e0d\u662fjvm\u7684\uff0c\u800c\u662fUTC\uff01\uff01<\/p>\n\n\n\n<p>\u6240\u4ee5\u52a1\u5fc5\u5728\u4f7f\u7528\u8be5\u6ce8\u89e3\u7684\u65f6\u5019\uff0c\u663e\u793a\u6307\u5b9a\u65f6\u533a\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    @JsonFormat(pattern = \"yyyy-MM-dd HH:mm\", timezone = \"GMT+8\")\n    private Date sendTime;<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5bf9\u4e8ejdk\u672c\u8eab\u7684SimpleDateFormat\u6216commons-lang\u5305\u4e2d\u7684DateFormatUtils [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[51],"tags":[59,35,58],"_links":{"self":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/341"}],"collection":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=341"}],"version-history":[{"count":1,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/341\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/341\/revisions\/344"}],"wp:attachment":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}