{"id":963,"date":"2018-09-17T18:52:48","date_gmt":"2018-09-17T09:52:48","guid":{"rendered":"https:\/\/chat-messenger.com\/?p=963"},"modified":"2018-12-23T01:52:16","modified_gmt":"2018-12-22T16:52:16","slug":"calendar-getactualmaximum","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/vi\/blog\/java\/lich-nhan-duoc-thuc-te-toi-da","title":{"rendered":"L\u1ea5y ng\u00e0y cu\u1ed1i th\u00e1ng trong Java"},"content":{"rendered":"<h2 class=\"common_title\"><a name=\"0\"><strong>Java <\/strong><strong>ng\u00e0y cu\u1ed1i th\u00e1ng<\/strong>l\u1ea5y <strong>Calendar.getActualMaximum()<\/strong><\/a><\/h2>\n<p>\n<strong>Java<\/strong>c\u1ee7a ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh trong<strong>ng\u00e0y cu\u1ed1i th\u00e1ng<\/strong>\u0110\u00e2y l\u00e0 m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh m\u1eabu \u0111\u1ec3 l\u1ea5y t\u1ec7p .<br \/>\n<strong>java.util.Calendar<\/strong>l\u1edbp h\u1ecdc<strong>getActualMaximum(L\u1ecbch.DATE)<\/strong>TRONG<strong>ng\u00e0y cu\u1ed1i th\u00e1ng<\/strong>c\u00f3 th\u1ec3 thu \u0111\u01b0\u1ee3c.\n<\/p>\n<h2 class=\"common_title\"><a name=\"1\">ch\u01b0\u01a1ng tr\u00ecnh m\u1eabu<\/a><\/h2>\n<pre class=\"sample_src\">\/** * Tr\u1ea3 v\u1ec1 ng\u00e0y cu\u1ed1i c\u00f9ng c\u1ee7a th\u00e1ng trong chu\u1ed7i ng\u00e0y \u0111\u00e3 ch\u1ec9 \u0111\u1ecbnh (yyyy\/MM\/dd ho\u1eb7c yyyy-MM-dd) *. * * @param strDate Chu\u1ed7i ng\u00e0y m\u1ee5c ti\u00eau * @return Ng\u00e0y cu\u1ed1i c\u00f9ng c\u1ee7a th\u00e1ng *\/ public static int getLastDay(String strDate) { if (strDate == null || strDate.length() != 10) { n\u00e9m IllegalArgumentException m\u1edbi( &quot; \u0110\u1ed1i s\u1ed1 Chu\u1ed7i [&quot;+ strDate +&quot;]&quot; + &quot;kh\u00f4ng h\u1ee3p l\u1ec7.&quot;); } int yyyy = Integer.parseInt(strDate.substring(0,4)); int MM = Integer.parseInt(strDate.substring(5 , 7)); int dd = Integer.parseInt(strDate.substring(8,10)); L\u1ecbch cal = Calendar.getInstance(); cal.set(yyyy,MM-1,dd); int Last = cal.getActualMaximum ( Calendar.DATE); tr\u1ea3 v\u1ec1 sau c\u00f9ng; }\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\">K\u1ebft qu\u1ea3 th\u1ef1c hi\u1ec7n<\/a><\/h2>\n<p>\u25c6V\u00ed d\u1ee5 th\u1ef1c thi<\/p>\n<pre class=\"sample_src\">public static void main(String[] args) { System.out.println(getLastDay(&quot;2007\/01\/01&quot;)); System.out.println(getLastDay(&quot;2007\/02\/01&quot;)); System.out .println(getLastDay(&quot;2008\/02\/01&quot;)); }\r\n<\/pre>\n<p>\u25c6K\u1ebft qu\u1ea3 \u0111\u1ea7u ra<\/p>\n<pre class=\"console\">31\r\n28\r\n29\r\n<\/pre>\n<p>*N\u0103m 2008 l\u00e0 n\u0103m nhu\u1eadn n\u00ean ng\u00e0y cu\u1ed1i c\u00f9ng c\u1ee7a th\u00e1ng 2 s\u1ebd l\u00e0 ng\u00e0y 29.<\/p>","protected":false},"excerpt":{"rendered":"<p>Java L\u1ea5y ng\u00e0y k\u1ebft th\u00fac c\u1ee7a th\u00e1ng Calendar.getActualMaximum() Ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh trong Java [\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\/vi\/wp-json\/wp\/v2\/posts\/963"}],"collection":[{"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/comments?post=963"}],"version-history":[{"count":4,"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/posts\/963\/revisions"}],"predecessor-version":[{"id":1874,"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/posts\/963\/revisions\/1874"}],"wp:attachment":[{"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/media?parent=963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/categories?post=963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chat-messenger.com\/vi\/wp-json\/wp\/v2\/tags?post=963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}