<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>breadcrumb-navxt</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/devtools/public_html/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
{"id":511,"date":"2011-11-03T07:35:00","date_gmt":"2011-11-03T10:35:00","guid":{"rendered":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/"},"modified":"2022-08-01T08:01:21","modified_gmt":"2022-08-01T11:01:21","slug":"funcao-para-formatar-data-no-postgresql","status":"publish","type":"post","link":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/","title":{"rendered":"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL"},"content":{"rendered":"\n<p>Dando sequencia ao assunto formata\u00e7\u00e3o de datas, qual j\u00e1 abordei anteriormente no <a href=\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-datas-no-mysql\/\">MySQL<\/a>, hoje veremos no PostgreSQL.<\/p>\n\n\n\n<p>Ent\u00e3o, vamos \u00e0 fun\u00e7\u00e3o:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> CREATE OR REPLACE FUNCTION \"paposql\".\"fun_converte_data\" (  \n  \"p_data\" timestamptz\n )  \n RETURNS varchar AS  \n $body$  \n DECLARE  \n l_ret   varchar  ;  \n BEGIN  \n l_ret := (to_char(p_data,'dd\/MM\/yyyy HH24:MI:SS'));  \n return l_ret;  \n END;  \n $body$  \n LANGUAGE 'plpgsql'  \n VOLATILE  \n CALLED ON NULL INPUT  \n SECURITY INVOKER  \n COST 100;  \n<\/code><\/pre>\n\n\n\n<p>A fun\u00e7\u00e3o tem como par\u00e2metro de entrada um timestamptz, representado aqui pelo p_data.<\/p>\n\n\n\n<p>Com o par\u00e2metro fornecido, converto a data para o formato Dia, M\u00eas, Ano, Hora, Minuto, Segundo atrav\u00e9s da fun\u00e7\u00e3o to_char alimentando a vari\u00e1vel l_ret, ap\u00f3s retorno a vari\u00e1vel com a informa\u00e7\u00e3o, simples n\u00e3o!<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div id=\"denakop-ad-horizontal-1\">\n<script type=\"9efebc54af0f6d4ea3792570-text\/javascript\">\n     denakop.cmd.push(function () {\n        denakop.displayAd({\n           divId: \"denakop-ad-horizontal-1\",\n           name: \"horizontal\",\n           refresh: 30,\n        });\n     });\n   <\/script>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Com esta fun\u00e7\u00e3o voc\u00ea tamb\u00e9m pode retornar somente a data, retirando os formatos HH24:MI:SS.<\/p>\n\n\n\n<p>Para testar a fun\u00e7\u00e3o, chame-a atrav\u00e9s do comando:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"http:\/\/4.bp.blogspot.com\/-ftMlfWMglYE\/UVGvoKrSgeI\/AAAAAAAAAjE\/TCvltYUCd78\/s1600\/Papo+Sql+-+Criando+uma+Fun%C3%A7%C3%A3o+no+PostgreSQL+-+Passo+7.png\"><img decoding=\"async\" src=\"http:\/\/4.bp.blogspot.com\/-ftMlfWMglYE\/UVGvoKrSgeI\/AAAAAAAAAjE\/TCvltYUCd78\/s400\/Papo+Sql+-+Criando+uma+Fun%C3%A7%C3%A3o+no+PostgreSQL+-+Passo+7.png\" alt=\"Executando a fun\u00e7\u00e3o para converter data no PostgreSQL\"\/><\/a><\/figure>\n<\/div>\n\n\n<p>Um abra\u00e7o a todos e at\u00e9 a pr\u00f3xima.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dando sequencia ao assunto formata\u00e7\u00e3o de datas, qual j\u00e1 abordei anteriormente no MySQL, hoje veremos no PostgreSQL. Ent\u00e3o, vamos \u00e0 fun\u00e7\u00e3o: A fun\u00e7\u00e3o tem como par\u00e2metro de entrada um timestamptz, representado aqui pelo p_data. Com o par\u00e2metro fornecido, converto a data para o formato Dia, M\u00eas, Ano, Hora, Minuto, Segundo atrav\u00e9s da fun\u00e7\u00e3o to_char alimentando &#8230; <a title=\"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL\" class=\"read-more\" href=\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\" aria-label=\"More on Fun\u00e7\u00e3o para Formatar Data no PostgreSQL\">Ler mais<\/a><\/p>\n","protected":false},"author":1,"featured_media":535,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[272,31],"tags":[],"class_list":["post-511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-banco-de-dados","category-postgresql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Fun\u00e7\u00e3o para Formatar Data no PostgreSQL<\/title>\n<meta name=\"description\" content=\"Dica de fun\u00e7\u00e3o para formatar datas no PostgreSQL\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL\" \/>\n<meta property=\"og:description\" content=\"Dica de fun\u00e7\u00e3o para formatar datas no PostgreSQL\" \/>\n<meta property=\"og:url\" content=\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\" \/>\n<meta property=\"og:site_name\" content=\"Devtools\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-03T10:35:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-01T11:01:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Fabiano Abreu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fabiano Abreu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\"},\"author\":{\"name\":\"Fabiano Abreu\",\"@id\":\"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed\"},\"headline\":\"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL\",\"datePublished\":\"2011-11-03T10:35:00+00:00\",\"dateModified\":\"2022-08-01T11:01:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\"},\"wordCount\":128,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed\"},\"image\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png\",\"articleSection\":[\"Banco de Dados\",\"PostgreSQL\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\",\"url\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\",\"name\":\"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL\",\"isPartOf\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png\",\"datePublished\":\"2011-11-03T10:35:00+00:00\",\"dateModified\":\"2022-08-01T11:01:21+00:00\",\"description\":\"Dica de fun\u00e7\u00e3o para formatar datas no PostgreSQL\",\"breadcrumb\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage\",\"url\":\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png\",\"contentUrl\":\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png\",\"width\":600,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/devtools.com.br\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/devtools.com.br\/blog\/#website\",\"url\":\"https:\/\/devtools.com.br\/blog\/\",\"name\":\"Devtools\",\"description\":\"Sua caixa de ferramentas online\",\"publisher\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/devtools.com.br\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed\",\"name\":\"Fabiano Abreu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2022\/07\/Fabiano-Abreu.png\",\"contentUrl\":\"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2022\/07\/Fabiano-Abreu.png\",\"width\":184,\"height\":184,\"caption\":\"Fabiano Abreu\"},\"logo\":{\"@id\":\"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/devtools.com.br\/blog\"],\"url\":\"https:\/\/devtools.com.br\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL","description":"Dica de fun\u00e7\u00e3o para formatar datas no PostgreSQL","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/","og_locale":"pt_BR","og_type":"article","og_title":"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL","og_description":"Dica de fun\u00e7\u00e3o para formatar datas no PostgreSQL","og_url":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/","og_site_name":"Devtools","article_published_time":"2011-11-03T10:35:00+00:00","article_modified_time":"2022-08-01T11:01:21+00:00","og_image":[{"width":600,"height":600,"url":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png","type":"image\/png"}],"author":"Fabiano Abreu","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Fabiano Abreu","Est. tempo de leitura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#article","isPartOf":{"@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/"},"author":{"name":"Fabiano Abreu","@id":"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed"},"headline":"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL","datePublished":"2011-11-03T10:35:00+00:00","dateModified":"2022-08-01T11:01:21+00:00","mainEntityOfPage":{"@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/"},"wordCount":128,"commentCount":3,"publisher":{"@id":"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed"},"image":{"@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png","articleSection":["Banco de Dados","PostgreSQL"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/","url":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/","name":"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL","isPartOf":{"@id":"https:\/\/devtools.com.br\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage"},"image":{"@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png","datePublished":"2011-11-03T10:35:00+00:00","dateModified":"2022-08-01T11:01:21+00:00","description":"Dica de fun\u00e7\u00e3o para formatar datas no PostgreSQL","breadcrumb":{"@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#primaryimage","url":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png","contentUrl":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2017\/02\/group_concat-no-postgresql.png","width":600,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/devtools.com.br\/blog\/funcao-para-formatar-data-no-postgresql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/devtools.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"Fun\u00e7\u00e3o para Formatar Data no PostgreSQL"}]},{"@type":"WebSite","@id":"https:\/\/devtools.com.br\/blog\/#website","url":"https:\/\/devtools.com.br\/blog\/","name":"Devtools","description":"Sua caixa de ferramentas online","publisher":{"@id":"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/devtools.com.br\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":["Person","Organization"],"@id":"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/aa3425fdfdefa404466fc49f6d122eed","name":"Fabiano Abreu","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/image\/","url":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2022\/07\/Fabiano-Abreu.png","contentUrl":"https:\/\/devtools.com.br\/blog\/wp-content\/uploads\/2022\/07\/Fabiano-Abreu.png","width":184,"height":184,"caption":"Fabiano Abreu"},"logo":{"@id":"https:\/\/devtools.com.br\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/devtools.com.br\/blog"],"url":"https:\/\/devtools.com.br\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/comments?post=511"}],"version-history":[{"count":3,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":1597,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions\/1597"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/media\/535"}],"wp:attachment":[{"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/media?parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/categories?post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devtools.com.br\/blog\/wp-json\/wp\/v2\/tags?post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}