{"id":1855,"date":"2022-08-30T15:20:00","date_gmt":"2022-08-30T15:20:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/android-i-cant-figure-out-simpledateformat-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:20:00","modified_gmt":"2022-08-30T15:20:00","slug":"android-i-cant-figure-out-simpledateformat-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/android-i-cant-figure-out-simpledateformat-collection-of-common-programming-errors\/","title":{"rendered":"Android: I can&#39;t figure out SimpleDateFormat-Collection of common programming errors"},"content":{"rendered":"<blockquote>\n<p>I get an unhandled type parse exception error on formatter.parse(str)<\/p>\n<\/blockquote>\n<p>For that, you&#8217;ll need to explicitly handle the exception, either by declaring that the currently executing method just throws it, or by catching it. For more information, I highly recommend going through the Exceptions Lesson in the Java Tutorial.<\/p>\n<p>Here&#8217;s an example of catching the exception.<\/p>\n<pre><code>String str = \"26\/08\/1994\";\nSimpleDateFormat formatter = new SimpleDateFormat(\"dd\/MM\/yyyy\"); \/\/please notice the    capital M\nDate date;\ntry\n{\n  date = formatter.parse(str);\n}\ncatch (ParseException e)\n{\n  \/\/ Handle error condition.\n}\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-12-02 21:01:38. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I get an unhandled type parse exception error on formatter.parse(str) For that, you&#8217;ll need to explicitly handle the exception, either by declaring that the currently executing method just throws it, or by catching it. For more information, I highly recommend going through the Exceptions Lesson in the Java Tutorial. Here&#8217;s an example of catching the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1855","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1855"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1855\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}