{"id":966,"date":"2018-12-17T18:54:14","date_gmt":"2018-12-17T09:54:14","guid":{"rendered":"https:\/\/chat-messenger.com\/?p=966"},"modified":"2019-07-04T01:23:07","modified_gmt":"2019-07-03T16:23:07","slug":"%e0%b8%9b%e0%b8%8f%e0%b8%b4%e0%b8%97%e0%b8%b4%e0%b8%99-day_of_week","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/th\/blog\/java\/calendar-day_of_week","title":{"rendered":"Java: \u0e04\u0e49\u0e19\u0e2b\u0e32\u0e27\u0e31\u0e19\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19\u0e02\u0e2d\u0e07\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c (\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49)"},"content":{"rendered":"<h2 class=\"common_title\"><a name=\"0\">\u0e0a\u0e27\u0e32 <strong>\u0e23\u0e30\u0e1a\u0e38\u0e27\u0e31\u0e19\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19 (\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49) \u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c<\/strong>\u3002 <strong>\u0e27\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c<\/strong><\/a><\/h2>\n<p>\n<strong>\u0e0a\u0e27\u0e32<\/strong> \u0e19\u0e35\u0e48\u0e04\u0e37\u0e2d\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e04\u0e25\u0e32\u0e2a Calendar \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e23\u0e31\u0e1a\u0e27\u0e31\u0e19\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19 (\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49) \u0e02\u0e2d\u0e07\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c<br \/>\n<br \/>\n\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e43\u0e2b\u0e49\u0e44\u0e14\u0e49\u0e21\u0e32\u0e0b\u0e36\u0e48\u0e07\u0e2a\u0e34\u0e48\u0e07\u0e19\u0e31\u0e49\u0e19 <strong>\u0e27\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c<\/strong> \u0e40\u0e23\u0e32\u0e08\u0e30\u0e43\u0e0a\u0e49\u0e2a\u0e34\u0e48\u0e07\u0e19\u0e35\u0e49\n<\/p>\n<div class=\"point\">\nCalendar cal = Calendar.getInstance(); <br \/>\nint week = cal.get(Calendar.DAY_OF_WEEK);\n<\/div>\n<p><strong>\u0e27\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c<\/strong>\u0e04\u0e48\u0e32\u0e17\u0e35\u0e48\u0e2a\u0e48\u0e07\u0e01\u0e25\u0e31\u0e1a\u0e40\u0e1b\u0e47\u0e19\u0e15\u0e31\u0e27\u0e40\u0e25\u0e02\u0e15\u0e31\u0e49\u0e07\u0e41\u0e15\u0e48 1 \u0e16\u0e36\u0e07 7 \u0e42\u0e14\u0e22\u0e40\u0e23\u0e34\u0e48\u0e21\u0e08\u0e32\u0e01 1 \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c \u0e14\u0e31\u0e07\u0e19\u0e31\u0e49\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e08\u0e36\u0e07\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07 switch \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e27\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c<\/p>\n<h2 class=\"common_title\"><a name=\"1\">\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21<\/a><\/h2>\n<pre class=\"sample_src\">\/**\r\n * \u73fe\u5728\u306e\u66dc\u65e5\u3092\u8fd4\u3057\u307e\u3059\u3002\r\n * @return\t\u73fe\u5728\u306e\u66dc\u65e5\r\n *\/\r\npublic static String getDayOfTheWeek() { \r\n    Calendar cal = Calendar.getInstance(); \r\n    switch (cal.get(Calendar.DAY_OF_WEEK)) {\r\n        case Calendar.SUNDAY: return \"\u65e5\u66dc\u65e5\";\r\n        case Calendar.MONDAY: return \"\u6708\u66dc\u65e5\";\r\n        case Calendar.TUESDAY: return \"\u706b\u66dc\u65e5\";\r\n        case Calendar.WEDNESDAY: return \"\u6c34\u66dc\u65e5\";\r\n        case Calendar.THURSDAY: return \"\u6728\u66dc\u65e5\";\r\n        case Calendar.FRIDAY: return \"\u91d1\u66dc\u65e5\";\r\n        case Calendar.SATURDAY: return \"\u571f\u66dc\u65e5\";\r\n    }\r\n    throw new IllegalStateException();\r\n}\r\n\/**\r\n * \u73fe\u5728\u306e\u66dc\u65e5\u3092\u8fd4\u3057\u307e\u3059\u3002\r\n * \u203b\u66dc\u65e5\u306f\u7701\u7565\u3057\u307e\u3059\u3002\r\n * @return\t\u73fe\u5728\u306e\u66dc\u65e5\r\n *\/\r\npublic static String getDayOfTheWeekShort() { \r\n    Calendar cal = Calendar.getInstance(); \r\n    switch (cal.get(Calendar.DAY_OF_WEEK)) {\r\n        case Calendar.SUNDAY: return \"\u65e5\";\r\n        case Calendar.MONDAY: return \"\u6708\";\r\n        case Calendar.TUESDAY: return \"\u706b\";\r\n        case Calendar.WEDNESDAY: return \"\u6c34\";\r\n        case Calendar.THURSDAY: return \"\u6728\";\r\n        case Calendar.FRIDAY: return \"\u91d1\";\r\n        case Calendar.SATURDAY: return \"\u571f\";\r\n    }\r\n    throw new IllegalStateException();\r\n}\t\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 class=\"common_title\"><a name=\"2\">\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e01\u0e32\u0e23\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23<\/a><\/h2>\n<p>\u25c6\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07<\/p>\n<pre class=\"sample_src\">public static void main(String[] args) { \/\/ \u0e41\u0e2a\u0e14\u0e07\u0e27\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19 System.out.println(&quot;\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e04\u0e37\u0e2d &quot; + getDayOfTheWeek() + &quot;.&quot;); \/\/ \u0e41\u0e2a\u0e14\u0e07\u0e27\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19\u0e41\u0e1a\u0e1a\u0e22\u0e48\u0e2d System.out.println(&quot;\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e04\u0e37\u0e2d &quot; + getDayOfTheWeekShort() + &quot;.&quot;); }\r\n<\/pre>\n<p>\u25c6\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c<\/p>\n<pre class=\"console\">\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e27\u0e31\u0e19\u0e1e\u0e38\u0e18 \u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e04\u0e37\u0e2d\u0e27\u0e31\u0e19\u0e19\u0e49\u0e33\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>java \u73fe\u5728\uff08\u4eca\u65e5\uff09\u306e\u66dc\u65e5\u3092\u53d6\u5f97\u3002 Calendar.DAY_OF_WEEK Java \u3067 Calendar [&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-966","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/966","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=966"}],"version-history":[{"count":7,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/966\/revisions"}],"predecessor-version":[{"id":3708,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/966\/revisions\/3708"}],"wp:attachment":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/media?parent=966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/categories?post=966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/tags?post=966"}],"curies":[{"name":"\u0e14\u0e31\u0e1a\u0e40\u0e1a\u0e34\u0e25\u0e22\u0e39\u0e1e\u0e35","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}