{"id":14700,"date":"2023-04-20T13:33:40","date_gmt":"2023-04-20T19:33:40","guid":{"rendered":"http:\/\/201.237.206.56\/Sitios\/ugit.siua.ac.cr\/?p=14700"},"modified":"2023-04-20T13:33:40","modified_gmt":"2023-04-20T19:33:40","slug":"sigesa-fecha-con-formato-fecha-hora-am-pm","status":"publish","type":"post","link":"https:\/\/sada.services\/?p=14700","title":{"rendered":"SIGESA: Fecha con formato fecha Hora AM\/PM"},"content":{"rendered":"\n<ul class=\"wp-block-list\">\n<li>Si dentro del JPA tenemos una fecha y deseamos darle un formato diferente <\/li>\n\n\n\n<li>Debemos agregar un trasient que la modifique<\/li>\n\n\n\n<li>import<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.text.SimpleDateFormat;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Trasient<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>@Transient\n    private String fechaHora;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Y metodo get que la modifique<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public String getFechaHora() {\n\n        try {\n            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(\"dd\/MM\/yyyy hh:mm aa\");\n            return simpleDateFormat.format(fecha); \n        }\n        catch (Exception e) {\n            return \"\";\n        }   \n    }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Asi que por ejemplo se utiliza en un bean ya lo podemos invocar<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public String getFechaHora() {\n\n        try {\n            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(\"dd\/MM\/yyyy hh:mm aa\");\n            return simpleDateFormat.format(fecha); \n        }\n        catch (Exception e) {\n            return \"\";\n        }   \n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[443],"tags":[505,503,504,444],"class_list":["post-14700","post","type-post","status-publish","format-standard","hentry","category-sigesa","tag-am-pmp","tag-fecha","tag-format","tag-sigesa"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts\/14700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14700"}],"version-history":[{"count":1,"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts\/14700\/revisions"}],"predecessor-version":[{"id":14701,"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts\/14700\/revisions\/14701"}],"wp:attachment":[{"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}