{"id":4718,"date":"2019-11-02T21:58:50","date_gmt":"2019-11-02T12:58:50","guid":{"rendered":"https:\/\/chat-messenger.com\/?p=4718"},"modified":"2024-01-14T02:34:30","modified_gmt":"2024-01-13T17:34:30","slug":"string-valueof-integer-parseint","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/ko\/blog\/java\/string-valueof-integer-parseint","title":{"rendered":"Java \uc22b\uc790 \u21d4 \ubb38\uc790\uc5f4 \u21d4 \ub0a0\uc9dc \ubcc0\ud658"},"content":{"rendered":"<h2>\uc22b\uc790 \u21d2 \ubb38\uc790\uc5f4 \ubcc0\ud658<\/h2>\n\n\n\n<p>\uc22b\uc790\uc5d0\uc11c \ubb38\uc790\uc5f4\ub85c\uc758 \ubcc0\ud658\uc740<strong>String.valueof()<\/strong> \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">String str = String.valueOf(num);<\/pre>\n\n\n\n<p>\ub610, \uadf8 \ubc16\uc5d0\ub3c4 \uc774\ub7ec\ud55c \uc4f0\ub294 \ubc29\ubc95\uc774 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">String str = Integer.toString(num); String str = &quot;&quot; + num;<\/pre>\n\n\n\n<p>\ub9c8\uc9c0\ub9c9 \u201c\u201d + num (\uc740)\ub294, \uce90\ub9ad\ud130 \ub77c\uc778\uacfc \uc5f0\uacb0\uc2dc\ud0a4\uba74 \uc218\uce58\ub97c \uce90\ub9ad\ud130 \ub77c\uc778\uc73c\ub85c\uc11c \ucde8\uae09\ud55c\ub2e4\uace0 \ud558\ub294 Java \uc758 \ud2b9\uc9d5\uc744 \ud65c\uc6a9\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\ub9c8\uc9c0\ub9c9 \ubc29\ubc95\uc774 \uac00\uc7a5 \uac04\ub2e8\ud558\uac8c \uae30\uc220\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4\ub9cc, Java \uc758 \ud2b9\uc131\uc744 \uc81c\ub300\ub85c \uc774\ud574\ud558\uace0 \uc788\uc9c0 \uc54a\ub294 \ubd84\uc774 \ubcf4\uba74, \uc758\ub3c4\ub97c \uc77d\uc5b4\ub0b4\ub294\ub370 \uc2dc\uac04\uc774 \uac78\ub9bd\ub2c8\ub2e4.<\/p>\n\n\n\n<h2>\ubb38\uc790\uc5f4 \u21d2 \uc22b\uc790 \ubcc0\ud658<\/h2>\n\n\n\n<p>\ubb38\uc790\uc5f4\uc5d0\uc11c \uc22b\uc790\ub85c\uc758 \ubcc0\ud658\uc740<strong>Integer.parseInt()<\/strong> \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">int num = Integer.parseInt(str);<\/pre>\n\n\n\n<p>\ubb38\uc790\uac00 \ub4e4\uc5b4\uac00 \uc788\uac70\ub098, \ud615\ud0dc\uc5d0 \ub4e4\uc5b4\uac00\uc9c0 \uc54a\ub294 \uc218\uce58\uc774\uac70\ub098\uc640, \uc5b4\ub5a0\ud55c \uc774\uc720\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc5c8\ub358 \uacbd\uc6b0\ub294 NumberFormatException \uac00 \ub418\uae30 \ub54c\ubb38\uc5d0 \uc8fc\uc758\uac00 \ud544\uc694\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h2>\ub0a0\uc9dc \u21d2 \ubb38\uc790\uc5f4 \ubcc0\ud658<\/h2>\n\n\n\n<p>\ub0a0\uc9dc\uc5d0\uc11c \ubb38\uc790\uc5f4\ub85c\uc758 \ubcc0\ud658\uc740 \uc22b\uc790 \u21d2 \ubb38\uc790\uc5f4\ubcf4\ub2e4 \uc57d\uac04 \ubcf5\uc7a1\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\uc6b0\uc120 <strong>SimpleDateFormat<\/strong> \uc758 \uc778\uc2a4\ud134\uc2a4\ub97c \ub9cc\ub4ed\ub2c8\ub2e4. \ub9cc\ub4e4 \ub54c \ub0a0\uc9dc \ud615\uc2dd\uc744 \uc9c0\uc815\ud569\ub2c8\ub2e4. \uc774\uac83\uc774 \uce90\ub9ad\ud130 \ub77c\uc778\uc73c\ub85c \ud588\uc744 \ub54c\uc758 \ud3ec\ub9f7\uc774 \ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\ub9c8\uc9c0\ub9c9\uc73c\ub85c <strong>SimpleDateFormat.format()<\/strong> \uc5d0\uc11c \ubb38\uc790\uc5f4\ub85c \ubcc0\ud658\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h4>\uc0d8\ud50c \ucf54\ub4dc<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-java\" data-lang=\"Java\"><code>public static void main(String[] args) {\n    Date date = new Date();\n    SimpleDateFormat sdf = new SimpleDateFormat(&quot;yyyy\/MM\/dd hh:mm:ss&quot;);\n    String str = sdf.format(date);\n    \n    System.out.println(&quot;\u65e5\u4ed8\u578b = &quot; + date);\n    System.out.println(&quot;\u6587\u5b57\u5217 = &quot; + str);\n}<\/code><\/pre><\/div>\n\n\n\n<h4>\ucd9c\ub825 \uacb0\uacfc:<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>\u65e5\u4ed8\u578b = Sat Nov 02 12:11:55 UTC 2019\n\u6587\u5b57\u5217 = 2019\/11\/02 12:11:55<\/code><\/pre><\/div>\n\n\n\n<h2>\ubb38\uc790\uc5f4 \u21d2 \ub0a0\uc9dc \ubcc0\ud658<\/h2>\n\n\n\n<p>\ubb38\uc790\uc5f4\uc744 \ub0a0\uc9dc\ub85c \ubcc0\ud658\ud558\ub824\uba74,<strong>SimpleDateFormat.parse<\/strong> \uba54\uc11c\ub4dc\ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\ub0a0\uc9dc \u21d2 \ubb38\uc790\uc5f4\uc758 \uacbd\uc6b0\uc640 \ub9c8\ucc2c\uac00\uc9c0\ub85c SimpleDateFormat\uc744 \ub9cc\ub4ed\ub2c8\ub2e4. \ub9cc\ub4e4 \ub54c \ub0a0\uc9dc \ud615\uc2dd\uc744 \uc9c0\uc815\ud558\uc9c0\ub9cc \ubcc0\ud658\ud560 \ubb38\uc790\uc5f4\uc758 \ub0a0\uc9dc \ud615\uc2dd\uacfc \uc77c\uce58\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\ub9c8\uc9c0\ub9c9\uc73c\ub85c <strong>SimpleDateFormat.parse()<\/strong> \ub85c \ub0a0\uc9dc(Date)\ub85c \ubcc0\ud658\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h4>\uc0d8\ud50c \ucf54\ub4dc<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-java\" data-lang=\"Java\"><code>public static void main(String[] args) {\n    try {\n        String strDate = &quot;2019\/11\/01 12:34:56&quot;;\n     \n        SimpleDateFormat sdf = new SimpleDateFormat(&quot;yyyy\/MM\/dd hh:mm:ss&quot;);\n        Date date = sdf.parse(strDate);\n        \n        System.out.println(&quot;\u6587\u5b57\u5217 = &quot; + strDate);\n        System.out.println(&quot;\u65e5\u4ed8\u578b = &quot; + date);\n        \n    } catch (ParseException e) {\n        \/\/\u4f8b\u5916\u51e6\u7406\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h4>\ucd9c\ub825 \uacb0\uacfc:<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>\u6587\u5b57\u5217 = 2019\/11\/01 12:34:56\n\u65e5\u4ed8\u578b = Fri Nov 01 00:34:56 UTC 2019<\/code><\/pre><\/div>\n\n\n\n<p>\ub610\ud55c, parse \uba54\uc18c\ub4dc\ub294 ParseException \ub97c \uc2ac\ub85c\uc6b0 \ud558\uace0 \uc788\uc73c\ubbc0\ub85c, try-catch \ubb38\uc73c\ub85c \ub458\ub7ec\uc2f8\ub294, \ub610\ub294 \uc7ac\ucc28 throw \ud558\uace0 \ub2e4\uc2dc \ud560 \ud544\uc694\uac00 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h2>\uc22b\uc790 \u21d4 \ub0a0\uc9dc \ubcc0\ud658<\/h2>\n\n\n\n<p>\uc218\uce58\ub85c\ubd80\ud130 \uc77c\uc790, \ub610\ub294 \uc77c\uc790\ub85c\ubd80\ud130 \uc218\uce58\uc5d0\uc758 \ubcc0\ud658\uc740, \uc720\uac10\uc2a4\ub7fd\uac8c\ub3c4, \uadf8\uac83\uc744 \uc704\ud574\uc11c \ub9cc\ub4e4\uc5b4\uc9c4 \uba54\uc18c\ub4dc\ub294 \uc5c6\uc2b5\ub2c8\ub2e4. \ub458 \ub2e4 \ud55c \ubc88 \ubb38\uc790\uc5f4\ub85c \ubcc0\ud658\uc744 \uac70\uccd0\uc57c\ud569\ub2c8\ub2e4.<\/p>","protected":false},"excerpt":{"rendered":"<p>\uc22b\uc790 \u21d2 \ubb38\uc790\uc5f4 \ubcc0\ud658 \uc22b\uc790\uc5d0\uc11c \ubb38\uc790\uc5f4\ub85c\uc758 \ubcc0\ud658\uc740 String.valueof() \ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4. String [\u2026]<\/p>","protected":false},"author":1,"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\/ko\/wp-json\/wp\/v2\/posts\/4718"}],"collection":[{"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/comments?post=4718"}],"version-history":[{"count":7,"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/posts\/4718\/revisions"}],"predecessor-version":[{"id":8895,"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/posts\/4718\/revisions\/8895"}],"wp:attachment":[{"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/media?parent=4718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/categories?post=4718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chat-messenger.com\/ko\/wp-json\/wp\/v2\/tags?post=4718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}