{"id":104746,"date":"2021-09-16T11:00:00","date_gmt":"2021-09-16T08:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=104746"},"modified":"2021-09-14T15:17:19","modified_gmt":"2021-09-14T12:17:19","slug":"date-format-in-sql","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/","title":{"rendered":"Date Format in SQL"},"content":{"rendered":"<p>In this article, we will explain the Date Format in SQL.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\"><img decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" alt=\"sql date format\" class=\"wp-image-1204\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo-70x70.jpg 70w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><\/figure>\n<\/div>\n<p>Structured Query Language (SQL) defines the date and time data types. In this example, I will use the MySQL database to demonstrate both date data types and corresponding utility functions.<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>DATE <\/strong>&#8211; stores a calendar date in the <strong>YYYY-MM-DD<\/strong> format. The valid date ranges from &#8216;<strong>0000-01-01<\/strong>&#8216; to &#8216;<strong>9999-12-31&#8242;.<\/strong><\/li>\n<li><strong>TIME <\/strong>&#8211; stores a clock value in the <strong>HH:MM:SS<\/strong> format. The valid time ranges from &#8216;<strong>00:00:00<\/strong>&#8216; to &#8216;<strong>23:59:59<\/strong>&#8216;.<\/li>\n<li><strong>TIMESTAMP <\/strong>&#8211; stores the date and time value in the <strong>YYYY-MM-DD HH:MM:SS<\/strong> format. The valid timestamp ranges from <strong>&#8216;1970-01-01 00:00:01<\/strong>&#8216; UTC to &#8216;<strong>2038-01-19 03:14:07<\/strong>&#8216; UTC.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-2-technologies-used\">2. Technologies Used<\/h2>\n<p>The example code in this article was built and run using:<\/p>\n<ul class=\"wp-block-list\">\n<li>MySQL<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-3-create-a-table\">3. Create a Table<\/h2>\n<p>I will create a <strong>DEMO_DATE_TBL <\/strong>table which has several columns with <strong>date<\/strong>, <strong>time<\/strong>, and <strong>timestamp <\/strong>data types.<\/p>\n<p><span style=\"text-decoration: underline\"><em>create table<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">create table DEMO_DATE_TBL(\n   USER_ID \tINT NOT NULL AUTO_INCREMENT,\n   USER_NAME \tVARCHAR(100) NOT NULL,\n   BIRTH_DATE\tDATE NOT NULL,\n   CREATED_ON\tTIMESTAMP NOT NULL,\n   SHIFT_START\tTIME NOT NULL,\n   SHIFT_END\tTIME NOT NULL,\n   PRIMARY KEY ( user_id )\n);<\/pre>\n<p>Insert several valid records.<\/p>\n<p><span style=\"text-decoration: underline\"><em>valid insert statements<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">insert into demo_date_tbl(user_name,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('Mary Zheng', '1970-12-01',  now(), '08:00:00', '17:00:00');\ninsert into demo_date_tbl(user_name,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('Tom Zheng', '1971-12-11',  now(), '08:00:00', '17:00:00');\ninsert into demo_date_tbl(user_name,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('Amy Zheng', '1970-12-13',  now(), '08:00:00', '17:00:00');\ninsert into demo_date_tbl(user_name,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('Mary Zhang', '1971-12-01',  now(), '08:00:00', '17:00:00');\ninsert into demo_date_tbl(user_name,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('Job Zhang', '1971-12-11',  now(), '08:00:00', '17:00:00');\ninsert into demo_date_tbl(user_name,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('Anne Zhang', '1970-12-13',  now(), '08:00:00', '17:00:00');\n <\/pre>\n<p>It will encounter an error message when the data is not in the valid range.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>invalid insert statements<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; insert into demo_date_tbl( user_name ,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('out-of-range', '10000-\n12-13',  now(), '08:00:00', '17:00:00');\nERROR 1292 (22007): Incorrect date value: '10000-12-13' for column 'birth_date' at row 1\nmysql&gt;\n\nmysql&gt; insert into demo_date_tbl( user_name ,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('out-of-range', '1900-12-13',  '1960-01-01', '08:00:00', '17:00:00');\nERROR 1292 (22007): Incorrect datetime value: '1960-01-01' for column 'CREATED_ON' at row 1\nmysql&gt;\n\nmysql&gt; insert into demo_date_tbl( user_name ,  birth_date, CREATED_ON, SHIFT_START, SHIFT_END) values('out-of-range', '1900-12-13',  '2960-01-01', '08:00:00', '17:00:00')\n    -&gt; ;\nERROR 1292 (22007): Incorrect datetime value: '2960-01-01' for column 'CREATED_ON' at row 1\nmysql&gt;<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-4-date-and-time-functions\">4. Date and Time Functions<\/h2>\n<p>MySQL provides a <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/date-and-time-functions.html\" target=\"_blank\" rel=\"noreferrer noopener\">list of date and time functions<\/a> to transform the date and time data. In this step, I will demonstrate the following common date functions.<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>DATE_FORMAT <\/strong>&#8211; the date type is formatted as <strong>YYYY-MM-DD<\/strong>, so we will use the <strong>date_format<\/strong> function to transform to a different format.<\/li>\n<li><strong>MONTH <\/strong>&#8211; it extracts the month value from either <strong>DATE <\/strong>or <strong>TIMESTAMP <\/strong>column.<\/li>\n<li><strong>MAKEDATE<\/strong> &#8211; it creates a date from a given year and number of days in a year.<\/li>\n<li><strong>CURRENT_TIME<\/strong> &#8211; it returns the current time.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline\"><em>date_format<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; select birth_date, date_format(birth_date, '%m-%d-%Y') from demo_date_tbl;\n+------------+-------------------------------------+\n| birth_date | date_format(birth_date, '%m-%d-%Y') |\n+------------+-------------------------------------+\n| 1970-12-01 | 12-01-1970                          |\n| 1971-12-11 | 12-11-1971                          |\n| 1970-12-13 | 12-13-1970                          |\n| 1971-12-01 | 12-01-1971                          |\n| 1971-12-11 | 12-11-1971                          |\n| 1970-12-13 | 12-13-1970                          |\n+------------+-------------------------------------+\n6 rows in set (0.00 sec)\n\nmysql&gt;<\/pre>\n<p><span style=\"text-decoration: underline\"><em>month<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; select month(birth_date) birth_month, month(created_on) create_month from demo_date_tbl;\n+-------------+--------------+\n| birth_month | create_month |\n+-------------+--------------+\n|          12 |            9 |\n|          12 |            9 |\n|          12 |            9 |\n|          12 |            9 |\n|          12 |            9 |\n|          12 |            9 |\n+-------------+--------------+\n6 rows in set (0.00 sec)<\/pre>\n<p><span style=\"text-decoration: underline\"><em>makedate<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; select makedate(2021, 09) ;\n+--------------------+\n| makedate(2021, 09) |\n+--------------------+\n| 2021-01-09         |\n+--------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select makedate(2021, 90) ;\n+--------------------+\n| makedate(2021, 90) |\n+--------------------+\n| 2021-03-31         |\n+--------------------+\n1 row in set (0.00 sec)\n\nmysql&gt;<\/pre>\n<p><span style=\"text-decoration: underline\"><em>current_time<\/em><\/span><\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; select * from demo_date_tbl where SHIFT_START &gt; current_time();\n+---------+------------+------------+---------------------+-------------+-----------+\n| user_id | user_name  | birth_date | CREATED_ON          | SHIFT_START | SHIFT_END |\n+---------+------------+------------+---------------------+-------------+-----------+\n|       1 | Mary Zheng | 1970-12-01 | 2021-09-13 02:27:40 | 08:00:00    | 17:00:00  |\n|       2 | Tom Zheng  | 1971-12-11 | 2021-09-13 02:27:40 | 08:00:00    | 17:00:00  |\n|       3 | Amy Zheng  | 1970-12-13 | 2021-09-13 02:27:40 | 08:00:00    | 17:00:00  |\n|       4 | Mary Zhang | 1971-12-01 | 2021-09-13 02:27:40 | 08:00:00    | 17:00:00  |\n|       5 | Job Zhang  | 1971-12-11 | 2021-09-13 02:27:40 | 08:00:00    | 17:00:00  |\n|       6 | Anne Zhang | 1970-12-13 | 2021-09-13 02:27:40 | 08:00:00    | 17:00:00  |\n+---------+------------+------------+---------------------+-------------+-----------+\n6 rows in set (0.00 sec)\n\nmysql&gt;<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-5-summary\">5. Summary<\/h2>\n<p>In this article, we explained the Date Format in SQL via the <strong>create table<\/strong> command with date and time data types and the utility functions to format a date and parse the date parts.<\/p>\n<p>Database servers provide date and time data types and corresponding functions. Please click <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/functions\/date-and-time-data-types-and-functions-transact-sql?view=sql-server-ver15\" target=\"_blank\" rel=\"noreferrer noopener\">SQL server date and time data types<\/a> for SQL Server database and <a href=\"https:\/\/docs.oracle.com\/cd\/B19306_01\/server.102\/b14225\/ch4datetime.htm\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for Oracle database.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-download-the-source-code\">6. Download the Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/09\/sql-date.zip\"><strong>Date Format in SQL<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this example, I will use the MySQL database to demonstrate both date data types and corresponding utility functions. DATE &#8211; stores a calendar date in the YYYY-MM-DD format. The valid &hellip;<\/p>\n","protected":false},"author":140,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[647],"class_list":["post-104746","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Date Format in SQL - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Date Format in SQL - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-16T08:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mary Zheng\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mary Zheng\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\"},\"author\":{\"name\":\"Mary Zheng\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae\"},\"headline\":\"Date Format in SQL\",\"datePublished\":\"2021-09-16T08:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\"},\"wordCount\":357,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"mysql\"],\"articleSection\":[\"sql\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\",\"name\":\"Date Format in SQL - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2021-09-16T08:00:00+00:00\",\"description\":\"In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"sql\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Date Format in SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae\",\"name\":\"Mary Zheng\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg\",\"caption\":\"Mary Zheng\"},\"description\":\"Mary has graduated from Mechanical Engineering department at ShangHai JiaoTong University. She also holds a Master degree in Computer Science from Webster University. During her studies she has been involved with a large number of projects ranging from programming and software engineering. She works as a senior Software Engineer in the telecommunications sector where she acts as a leader and works with others to design, implement, and monitor the software solution.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/mary-zheng\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Date Format in SQL - Java Code Geeks","description":"In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this","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:\/\/examples.javacodegeeks.com\/date-format-in-sql\/","og_locale":"en_US","og_type":"article","og_title":"Date Format in SQL - Java Code Geeks","og_description":"In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this","og_url":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-09-16T08:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Mary Zheng","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mary Zheng","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/"},"author":{"name":"Mary Zheng","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae"},"headline":"Date Format in SQL","datePublished":"2021-09-16T08:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/"},"wordCount":357,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["mysql"],"articleSection":["sql"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/","url":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/","name":"Date Format in SQL - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2021-09-16T08:00:00+00:00","description":"In this article, we will explain the Date Format in SQL. 1. Introduction Structured Query Language (SQL) defines the date and time data types. In this","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/date-format-in-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"sql","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/"},{"@type":"ListItem","position":5,"name":"Date Format in SQL"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae","name":"Mary Zheng","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg","caption":"Mary Zheng"},"description":"Mary has graduated from Mechanical Engineering department at ShangHai JiaoTong University. She also holds a Master degree in Computer Science from Webster University. During her studies she has been involved with a large number of projects ranging from programming and software engineering. She works as a senior Software Engineer in the telecommunications sector where she acts as a leader and works with others to design, implement, and monitor the software solution.","url":"https:\/\/examples.javacodegeeks.com\/author\/mary-zheng\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/104746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=104746"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/104746\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=104746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=104746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=104746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}