{"id":2478,"date":"2025-03-19T21:05:47","date_gmt":"2025-03-19T14:05:47","guid":{"rendered":"https:\/\/www.pgtutorial.com\/?page_id=2478"},"modified":"2025-03-19T21:08:17","modified_gmt":"2025-03-19T14:08:17","slug":"postgresql-date-format","status":"publish","type":"page","link":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/","title":{"rendered":"PostgreSQL Date Format"},"content":{"rendered":"\n<p>The following table shows the date format you can use to format a date, time, or timestamp:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Pattern<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><strong>Y,YYY<\/strong><\/td><td>Year in 4 digits with a comma (e.g., <code>2,025<\/code>)<\/td><\/tr><tr><td><strong>YYYY<\/strong><\/td><td>Year in 4 digits (e.g., <code>2025<\/code>)<\/td><\/tr><tr><td><strong>YYY<\/strong><\/td><td>Last 3 digits of the year (e.g., <code>025<\/code> for <code>2025<\/code>)<\/td><\/tr><tr><td><strong>YY<\/strong><\/td><td>Last 2 digits of the year (e.g., <code>25<\/code> for <code>2025<\/code>)<\/td><\/tr><tr><td><strong>Y<\/strong><\/td><td>Last digit of the year (e.g., <code>5<\/code> for <code>2025<\/code>)<\/td><\/tr><tr><td><strong>IYYY<\/strong><\/td><td>ISO 8601 week-numbering year in 4 digits<\/td><\/tr><tr><td><strong>IYY<\/strong><\/td><td>Last 3 digits of the ISO 8601 week-numbering year<\/td><\/tr><tr><td><strong>IY<\/strong><\/td><td>Last 2 digits of the ISO 8601 week-numbering year<\/td><\/tr><tr><td><strong>I<\/strong><\/td><td>Last digit of the ISO 8601 week-numbering year<\/td><\/tr><tr><td><strong>BC, bc, AD, ad<\/strong><\/td><td>Era indicator without periods (e.g., <code>BC<\/code>, <code>AD<\/code>)<\/td><\/tr><tr><td><strong>B.C., b.c., A.D., a.d.<\/strong><\/td><td>Era indicator with periods (e.g., <code>B.C.<\/code>, <code>A.D.<\/code>)<\/td><\/tr><tr><td><strong>MONTH<\/strong><\/td><td>Full month name in uppercase (e.g., <code>MARCH<\/code>)<\/td><\/tr><tr><td><strong>Month<\/strong><\/td><td>Full month name with first letter capitalized (e.g., <code>March<\/code>)<\/td><\/tr><tr><td><strong>month<\/strong><\/td><td>Full month name in lowercase (e.g., <code>march<\/code>)<\/td><\/tr><tr><td><strong>MON<\/strong><\/td><td>Abbreviated month name in uppercase (e.g., <code>MAR<\/code>)<\/td><\/tr><tr><td><strong>Mon<\/strong><\/td><td>Abbreviated month name with first letter capitalized (e.g., <code>Mar<\/code>)<\/td><\/tr><tr><td><strong>mon<\/strong><\/td><td>Abbreviated month name in lowercase (e.g., <code>mar<\/code>)<\/td><\/tr><tr><td><strong>MM<\/strong><\/td><td>Month number (01-12)<\/td><\/tr><tr><td><strong>DAY<\/strong><\/td><td>Full weekday name in uppercase (e.g., <code>TUESDAY<\/code>)<\/td><\/tr><tr><td><strong>Day<\/strong><\/td><td>Full weekday name with first letter capitalized (e.g., <code>Tuesday<\/code>)<\/td><\/tr><tr><td><strong>day<\/strong><\/td><td>Full weekday name in lowercase (e.g., <code>tuesday<\/code>)<\/td><\/tr><tr><td><strong>DY<\/strong><\/td><td>Abbreviated weekday name in uppercase (e.g., <code>TUE<\/code>)<\/td><\/tr><tr><td><strong>Dy<\/strong><\/td><td>Abbreviated weekday name with first letter capitalized (e.g., <code>Tue<\/code>)<\/td><\/tr><tr><td><strong>dy<\/strong><\/td><td>Abbreviated weekday name in lowercase (e.g., <code>tue<\/code>)<\/td><\/tr><tr><td><strong>DDD<\/strong><\/td><td>Day of the year (001-366)<\/td><\/tr><tr><td><strong>IDDD<\/strong><\/td><td>Day of the ISO 8601 week-numbering year (001-366)<\/td><\/tr><tr><td><strong>DD<\/strong><\/td><td>Day of the month (01-31)<\/td><\/tr><tr><td><strong>D<\/strong><\/td><td>Day of the week (1 = Sunday, 7 = Saturday)<\/td><\/tr><tr><td><strong>ID<\/strong><\/td><td>ISO 8601 day of the week (1 = Monday, 7 = Sunday)<\/td><\/tr><tr><td><strong>W<\/strong><\/td><td>Week of the month (1-5, where the first week starts on the first day of the month)<\/td><\/tr><tr><td><strong>WW<\/strong><\/td><td>Week number of the year (1-53, where the first week starts on the first day of the year)<\/td><\/tr><tr><td><strong>IW<\/strong><\/td><td>ISO 8601 week number of the year (01-53, where week 1 contains the first Thursday of the year)<\/td><\/tr><tr><td><strong>CC<\/strong><\/td><td>Century (e.g., <code>21<\/code> for years 2000-2099)<\/td><\/tr><tr><td><strong>J<\/strong><\/td><td>Julian Day (integer days since November 24, 4714 BC, at noon UTC)<\/td><\/tr><tr><td><strong>RM<\/strong><\/td><td>Month in uppercase Roman numerals (I-XII; <code>I<\/code> = January, <code>XII<\/code> = December)<\/td><\/tr><tr><td><strong>rm<\/strong><\/td><td>Month in lowercase Roman numerals (i-xii; <code>i<\/code> = January, <code>xii<\/code> = December)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><br><\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2478\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL Date Format\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2478\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL Date Format\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp..<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2440,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2478","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PostgreSQL Date Format<\/title>\n<meta name=\"description\" content=\"This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL Date Format\" \/>\n<meta property=\"og:description\" content=\"This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/\" \/>\n<meta property=\"og:site_name\" content=\"PostgreSQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-19T14:08:17+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-date-functions\\\/postgresql-date-format\\\/\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-date-functions\\\/postgresql-date-format\\\/\",\"name\":\"PostgreSQL Date Format\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\"},\"datePublished\":\"2025-03-19T14:05:47+00:00\",\"dateModified\":\"2025-03-19T14:08:17+00:00\",\"description\":\"This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-date-functions\\\/postgresql-date-format\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-date-functions\\\/postgresql-date-format\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-date-functions\\\/postgresql-date-format\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Date Functions\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-date-functions\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL Date Format\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/\",\"name\":\"PostgreSQL Tutorial\",\"description\":\"Learn PostgreSQL from Scratch\",\"alternateName\":\"PostgreSQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pgtutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL Date Format","description":"This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp.","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"PostgreSQL Date Format","og_description":"This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp.","og_url":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/","og_site_name":"PostgreSQL Tutorial","article_modified_time":"2025-03-19T14:08:17+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/","url":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/","name":"PostgreSQL Date Format","isPartOf":{"@id":"https:\/\/www.pgtutorial.com\/#website"},"datePublished":"2025-03-19T14:05:47+00:00","dateModified":"2025-03-19T14:08:17+00:00","description":"This PostgreSQL Date Format table lists out all the date format patterns for formatting a date, time, or timestamp.","breadcrumb":{"@id":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/postgresql-date-format\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pgtutorial.com\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Date Functions","item":"https:\/\/www.pgtutorial.com\/postgresql-date-functions\/"},{"@type":"ListItem","position":3,"name":"PostgreSQL Date Format"}]},{"@type":"WebSite","@id":"https:\/\/www.pgtutorial.com\/#website","url":"https:\/\/www.pgtutorial.com\/","name":"PostgreSQL Tutorial","description":"Learn PostgreSQL from Scratch","alternateName":"PostgreSQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pgtutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/comments?post=2478"}],"version-history":[{"count":3,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2478\/revisions"}],"predecessor-version":[{"id":2481,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2478\/revisions\/2481"}],"up":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/2440"}],"wp:attachment":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/media?parent=2478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}