{"id":969,"date":"2019-04-22T18:55:54","date_gmt":"2019-04-22T09:55:54","guid":{"rendered":"https:\/\/chat-messenger.com\/?p=969"},"modified":"2019-10-19T13:22:04","modified_gmt":"2019-10-19T04:22:04","slug":"%e0%b9%81%e0%b8%a2%e0%b8%81%e0%b8%a3%e0%b8%b9%e0%b8%9b%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b8%a7%e0%b8%b1%e0%b8%99%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b8%ad%e0%b8%a2%e0%b9%88%e0%b8%b2%e0%b8%87%e0%b8%87%e0%b9%88","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/th\/blog\/java\/simpledateformat-parse","title":{"rendered":"\u0e01\u0e32\u0e23\u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e0a\u0e19\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 Date \u0e43\u0e19\u0e20\u0e32\u0e29\u0e32 Java"},"content":{"rendered":"<h2><strong>\u0e0a\u0e27\u0e32<\/strong> <strong>\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong>\u3092 <strong>\u0e08\u0e32\u0e27\u0e32.\u0e22\u0e39\u0e17\u0e34\u0e25\u0e34\u0e15\u0e35\u0e49.\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong> \u0e23\u0e31\u0e1a\u0e15\u0e32\u0e21\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17<\/h2>\n<p>\n\u0e43\u0e19\u0e20\u0e32\u0e29\u0e32 Java \u0e08\u0e30\u0e08\u0e31\u0e14\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 (\u0e1b\u0e35\/\u0e40\u0e14\u0e37\u0e2d\u0e19\/\u0e27\u0e31\u0e19) \u0e44\u0e14\u0e49\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e23 <strong>\u0e08\u0e32\u0e27\u0e32.\u0e22\u0e39\u0e17\u0e34\u0e25\u0e34\u0e15\u0e35\u0e49.\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong> \u0e19\u0e35\u0e48\u0e04\u0e37\u0e2d\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e41\u0e1b\u0e25\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e40\u0e1b\u0e47\u0e19\u0e0a\u0e19\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2b\u0e19\u0e36\u0e48\u0e07\n<\/p>\n<h2>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e04\u0e49\u0e14<\/h2>\n<pre class=\"sample_src\">\r\n\/** * \u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 &quot;yyyy\/MM\/dd&quot; \u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 java.util.Date * @param str \u0e2a\u0e15\u0e23\u0e34\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e41\u0e1b\u0e25\u0e07 * @return \u0e2d\u0e47\u0e2d\u0e1a\u0e40\u0e08\u0e47\u0e01\u0e15\u0e4c java.util.Date \u0e17\u0e35\u0e48\u0e41\u0e1b\u0e25\u0e07\u0e41\u0e25\u0e49\u0e27 * @throws ParseException \u0e2b\u0e32\u0e01\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e43\u0e0a\u0e48 &quot;yyyy\/MM\/dd&quot; *\/ public static Date toDate(String str) throws ParseException { Date date = DateFormat.getDateInstance().parse(str); return date; }\r\n<\/pre>\n<p><script type=\"text\/javascript\" src=\"https:\/\/chat-messenger.com\/js\/common.js?dd12sssas2223\" charset=\"UTF-8\"><\/script><br \/>\n<script type=\"text\/javascript\"> writePR(); <\/script><\/p>\n<h2>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e01\u0e32\u0e23\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23<\/h2>\n<h4>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21<\/h4>\n<pre class=\"sample_src\">\r\npublic static void main(String[] args) { try { \/\/ \u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e1b\u0e01\u0e15\u0e34 date = toDate(&quot;2007\/01\/01&quot;); System.out.println(date); \/\/ \u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e17\u0e35\u0e48\u0e41\u0e15\u0e01\u0e15\u0e48\u0e32\u0e07 pattern date = toDate(&quot;2007-01-01&quot;); System.out.println(date); } catch (ParseException e) { e.printStackTrace(); } }\r\n<\/pre>\n<h4>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49<\/h4>\n<pre class=\"console\">2007\/01\/01=&#039;\u0e08\u0e31\u0e19\u0e17\u0e23\u0e4c\u0e17\u0e35\u0e48 01 \u0e21\u0e01\u0e23\u0e32\u0e04\u0e21 00:00:00 JST 2007&#039;'\r\n<\/pre>\n<p>\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 yyyy\/MM\/dd \u0e14\u0e39\u0e40\u0e2b\u0e21\u0e37\u0e2d\u0e19\u0e08\u0e30\u0e41\u0e1b\u0e25\u0e07\u0e44\u0e14\u0e49\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\u0e41\u0e25\u0e49\u0e27 \u0e41\u0e15\u0e48\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a yyyy-MM-dd \u0e25\u0e48\u0e30?<\/p>\n<pre class=\"console\">java.text.ParseException: \u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e41\u0e22\u0e01\u0e27\u0e34\u0e40\u0e04\u0e23\u0e32\u0e30\u0e2b\u0e4c\u0e44\u0e14\u0e49: &quot;2007-01-01&quot; \u0e17\u0e35\u0e48 java.text.DateFormat.parse(DateFormat.java:335) \u0e17\u0e35\u0e48 Main.toDate(DateUtil.java:627) \u0e17\u0e35\u0e48 Main.main(DateUtil.java:639)\r\n<\/pre>\n<p>\u0e40\u0e01\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e1c\u0e34\u0e14\u0e1e\u0e25\u0e32\u0e14 ParseException \u0e02\u0e36\u0e49\u0e19\u0e43\u0e19\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 yyyy-MM-dd<\/p>\n<p><strong>\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong> \u0e04\u0e25\u0e32\u0e2a\u0e22\u0e48\u0e2d\u0e22 <strong>java.text.\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e41\u0e1a\u0e1a\u0e07\u0e48\u0e32\u0e22<\/strong> \u0e04\u0e38\u0e13\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e41\u0e1b\u0e25\u0e07\u0e44\u0e14\u0e49\u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e27\u0e34\u0e18\u0e35\u0e15\u0e48\u0e2d\u0e44\u0e1b\u0e19\u0e35\u0e49<\/p>\n<pre class=\"sample_src\">SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");\r\nformat.parse(\"2007-01-01\");  \r\n<\/pre>\n<p>\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e44\u0e14\u0e49\u0e2b\u0e25\u0e32\u0e01\u0e2b\u0e25\u0e32\u0e22\u0e01\u0e27\u0e48\u0e32\u0e19\u0e35\u0e49\u0e44\u0e21\u0e48\u0e43\u0e0a\u0e48\u0e2b\u0e23\u0e37\u0e2d?<br \/>\n\u0e15\u0e48\u0e2d\u0e44\u0e1b \u0e40\u0e23\u0e32\u0e08\u0e30\u0e41\u0e2a\u0e14\u0e07\u0e27\u0e34\u0e18\u0e35\u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e43\u0e14\u0e46 \u0e43\u0e2b\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 java.util.Date \u0e40\u0e21\u0e37\u0e48\u0e2d\u0e43\u0e14\u0e01\u0e47\u0e15\u0e32\u0e21\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e44\u0e1b\u0e44\u0e14\u0e49<br \/>\n<a href=\"\/th\/%e0%b8%9a%e0%b8%a5%e0%b9%87%e0%b8%ad%e0%b8%81\/%e0%b8%8a%e0%b8%a7%e0%b8%b2\/%e0%b8%97%e0%b8%b8%e0%b8%81%e0%b8%aa%e0%b8%95%e0%b8%a3%e0%b8%b4%e0%b8%87%e0%b8%a7%e0%b8%b1%e0%b8%99%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%9b%e0%b8%a2%e0%b8%b1%e0%b8%87%e0%b8%9b%e0%b8%8f%e0%b8%b4\/\">&quot;\u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e43\u0e14\u0e46 \u0e43\u0e2b\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2b\u0e23\u0e37\u0e2d\u0e1b\u0e0f\u0e34\u0e17\u0e34\u0e19&quot;<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Java \u65e5\u4ed8\u6587\u5b57\u5217\u3092 java.util.Date \u578b\u3067\u53d6\u5f97 Java \u3067\u65e5\u4ed8\u6587\u5b57\u5217 \uff08\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 yyy [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[19],"tags":[],"class_list":["post-969","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/969","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/comments?post=969"}],"version-history":[{"count":10,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/969\/revisions"}],"predecessor-version":[{"id":4620,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/969\/revisions\/4620"}],"wp:attachment":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/media?parent=969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/categories?post=969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/tags?post=969"}],"curies":[{"name":"\u0e14\u0e31\u0e1a\u0e40\u0e1a\u0e34\u0e25\u0e22\u0e39\u0e1e\u0e35","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}