{"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":"simpledateformat-parse","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/th\/\u0e1a\u0e25\u0e47\u0e2d\u0e01\/java\/\u0e41\u0e22\u0e01\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e07\u0e48","title":{"rendered":"\u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Java \u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48"},"content":{"rendered":"<h2><strong>\u0e0a\u0e27\u0e32<\/strong> <strong>\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong>\u0e02\u0e2d\u0e07 <strong>java.util.\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong> \u0e23\u0e31\u0e1a\u0e15\u0e32\u0e21\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17<\/h2>\n<p>\n\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 (\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a \u0e1b\u0e1b\u0e1b\u0e1b\/\u0e14\u0e14\/\u0e27\u0e27) \u0e43\u0e19\u0e20\u0e32\u0e29\u0e32 Java <strong>java.util.\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\u0e43\u0e19\u0e01\u0e32\u0e23\u0e41\u0e1b\u0e25\u0e07\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\n<\/p>\n<h2>\u0e23\u0e2b\u0e31\u0e2a\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07<\/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 java.util.Date \u0e27\u0e31\u0e15\u0e16\u0e38\u0e2b\u0e25\u0e31\u0e07\u0e01\u0e32\u0e23\u0e41\u0e1b\u0e25\u0e07 * @throws ParseException \u0e2b\u0e32\u0e01\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2d\u0e37\u0e48\u0e19\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e43\u0e0a\u0e48 &quot;yyyy\/MM\/dd&quot; *\/ public static Date toDate(String str) \u0e1e\u0e48\u0e19 ParseException { Date date = DateFormat.getDateInstance().parse(str); \u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2a\u0e48\u0e07\u0e04\u0e37\u0e19; }\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\u0e01\u0e32\u0e23\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23<\/h2>\n<h4>\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07<\/h4>\n<pre class=\"sample_src\">\r\n\u0e42\u0e21\u0e06\u0e30\u0e04\u0e07\u0e17\u0e35\u0e48\u0e2a\u0e32\u0e18\u0e32\u0e23\u0e13\u0e30 main (String [] args) { \u0e25\u0e2d\u0e07 { \/\/ \u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e1b\u0e01\u0e15\u0e34 \u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 date = toDate (&quot;2007\/01\/01&quot;); System.out.println (date); \/\/ \u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e17\u0e35\u0e48\u0e21\u0e35\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e41\u0e15\u0e01\u0e15\u0e48\u0e32\u0e07\u0e01\u0e31\u0e19 date = toDate ( &quot;2007-01-01&quot;); System.out.println (\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48); } catch (ParseException e) { e.printStackTrace(); } }\r\n<\/pre>\n<h4>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e40\u0e2d\u0e32\u0e17\u0e4c\u0e1e\u0e38\u0e15<\/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>\u0e14\u0e39\u0e40\u0e2b\u0e21\u0e37\u0e2d\u0e19\u0e27\u0e48\u0e32\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 yyyy\/MM\/dd \u0e08\u0e30\u0e16\u0e39\u0e01\u0e41\u0e1b\u0e25\u0e07\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07 \u0e41\u0e15\u0e48\u0e41\u0e25\u0e49\u0e27 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>ParseException \u0e40\u0e01\u0e34\u0e14\u0e02\u0e36\u0e49\u0e19\u0e43\u0e19 yyyy-MM-dd<\/p>\n<p><strong>\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48<\/strong> \u0e02\u0e2d\u0e07\u0e04\u0e25\u0e32\u0e2a\u0e22\u0e48\u0e2d\u0e22\u0e02\u0e2d\u0e07 <strong>java.text.SimpleDateFormat<\/strong> \u0e04\u0e38\u0e13\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e41\u0e1b\u0e25\u0e07\u0e44\u0e14\u0e49\u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e41\u0e25\u0e30\u0e40\u0e02\u0e35\u0e22\u0e19\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n<pre class=\"sample_src\">\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a SimpleDateFormat = SimpleDateFormat \u0e43\u0e2b\u0e21\u0e48(&quot;yyyy-MM-dd&quot;); format.parse(&quot;2007-01-01&quot;);  \r\n<\/pre>\n<p>\u0e09\u0e31\u0e19\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e17\u0e35\u0e48\u0e21\u0e35\u0e27\u0e31\u0e15\u0e16\u0e38\u0e1b\u0e23\u0e30\u0e2a\u0e07\u0e04\u0e4c\u0e17\u0e31\u0e48\u0e27\u0e44\u0e1b\u0e21\u0e32\u0e01\u0e02\u0e36\u0e49\u0e19<br \/>\n\u0e15\u0e48\u0e2d\u0e44\u0e1b \u0e40\u0e23\u0e32\u0e08\u0e30\u0e41\u0e2a\u0e14\u0e07\u0e27\u0e34\u0e18\u0e35\u0e01\u0e32\u0e23\u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e43\u0e2b\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 java.util.Date \u0e17\u0e38\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e44\u0e1b\u0e44\u0e14\u0e49<br \/>\n<a href=\"https:\/\/chat-messenger.com\/th\/\u0e1a\u0e25\u0e47\u0e2d\u0e01\/java\/\u0e17\u0e38\u0e01\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e44\u0e1b\u0e22\u0e31\u0e07\u0e1b\u0e0f\u0e34\/\">&quot;\u0e41\u0e1b\u0e25\u0e07\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\/\u0e40\u0e27\u0e25\u0e32\u0e43\u0e2b\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2b\u0e23\u0e37\u0e2d\u0e1b\u0e0f\u0e34\u0e17\u0e34\u0e19&quot;<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u0e23\u0e31\u0e1a\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Java \u0e40\u0e1b\u0e47\u0e19 java.util.Date \u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e2a\u0e15\u0e23\u0e34\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e43\u0e19 Java (\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a yyy [\u2026]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":""},"categories":[19],"tags":[],"_links":{"self":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/969"}],"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":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}