{"id":8455,"date":"2020-12-21T07:11:00","date_gmt":"2020-12-21T07:11:00","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=8455"},"modified":"2025-08-29T05:53:47","modified_gmt":"2025-08-29T05:53:47","slug":"how-to-get-current-date-and-time-in-mysql","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/","title":{"rendered":"How to Get Current Date and Time in MySQL"},"content":{"rendered":"\n<p>MySQL is a popular database used by millions of websites and apps. It supports different data types and offers tons of features to work with them. While working with MySQL, almost everyone needs to deal with datetime information at sometime or the other. Often you may need to get date from datetime or get current datetime. In this article, we will look at how to get current date and time in MySQL.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#Why_Get_Current_Date_Time\" >Why Get Current Date &amp; Time<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#How_to_Get_Current_Date_and_Time_in_MySQL\" >How to Get Current Date and Time in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#1_Using_Now_Function\" >1. Using Now() Function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#2_Using_current_timestamp\" >2. Using current_timestamp()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#3_Using_current_date\" >3. Using current_date<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#4_Using_current_time\" >4. Using current_time<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_Get_Current_Date_Time\"><\/span>Why Get Current Date &amp; Time<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>MySQL is commonly used as a transactional database to store data about online commerce. In such cases,   web developers and database programmers need to get current date and time values in order to record each transaction correctly &#8211; whether it is adding to cart, checkout, cancellation, refund, invoicing, etc. So it is important to know how to retrieve current date and time values in MySQL. Otherwise, you will not be able to track your transactions correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Get_Current_Date_and_Time_in_MySQL\"><\/span>How to Get Current Date and Time in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are several ways to get current date and time in MySQL. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_Now_Function\"><\/span>1. Using Now() Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now() function is a system function that directly returns current date and time, when invoked in query. It does not require any input parameters. You can run NOW() function to get current date and time in MySQL.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select now();\n+---------------------+\n| now()               |\n+---------------------+\n| 2020-12-21 12:18:33 |\n+---------------------+<\/pre>\n\n\n\n<p>You can also use <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-interval\/\">interval<\/a> clause to add\/subtract months, weeks, days, hours, minutes and seconds from the current date returned by now(), as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select now() - interval 1 month;<br>+--------------------------+<br>| now() - interval 1 month |<br>+--------------------------+<br>| 2024-06-11 11:53:38      |<br>+--------------------------+<br><br>mysql&gt; select now() + interval 1 month;<br>+--------------------------+<br>| now() + interval 1 month |<br>+--------------------------+<br>| 2024-08-11 11:53:41      |<br>+--------------------------+<br><br>mysql&gt; select now() - interval 1 week;<br>+-------------------------+<br>| now() - interval 1 week |<br>+-------------------------+<br>| 2024-07-04 11:53:47     |<br>+-------------------------+<br><br>mysql&gt; select now() + interval 1 week;<br>+-------------------------+<br>| now() + interval 1 week |<br>+-------------------------+<br>| 2024-07-18 11:53:51     |<br>+-------------------------+<br><br>mysql&gt; select now() - interval 1 day;<br>+------------------------+<br>| now() - interval 1 day |<br>+------------------------+<br>| 2024-07-10 11:53:55    |<br>+------------------------+<br><br>mysql&gt; select now() + interval 1 day;<br>+------------------------+<br>| now() + interval 1 day |<br>+------------------------+<br>| 2024-07-12 11:53:59    |<br>+------------------------+<br><br>mysql&gt; select now() - interval 1 hour;<br>+-------------------------+<br>| now() - interval 1 hour |<br>+-------------------------+<br>| 2024-07-11 10:54:08     |<br>+-------------------------+<br><br>mysql&gt; select now() + interval 1 hour;<br>+-------------------------+<br>| now() + interval 1 hour |<br>+-------------------------+<br>| 2024-07-11 12:54:11     |<br>+-------------------------+<br><br>mysql&gt; select now() - interval 1 minute;<br>+---------------------------+<br>| now() - interval 1 minute |<br>+---------------------------+<br>| 2024-07-11 11:53:19       |<br>+---------------------------+<br><br>mysql&gt; select now() + interval 1 minute;<br>+---------------------------+<br>| now() + interval 1 minute |<br>+---------------------------+<br>| 2024-07-11 11:55:23       |<br>+---------------------------+<br><br>mysql&gt; select now() - interval 1 second;<br>+---------------------------+<br>| now() - interval 1 second |<br>+---------------------------+<br>| 2024-07-11 11:54:26       |<br>+---------------------------+<br><br>mysql&gt; select now() + interval 1 second;<br>+---------------------------+<br>| now() + interval 1 second |<br>+---------------------------+<br>| 2024-07-11 11:54:32       |<br>+---------------------------+<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_current_timestamp\"><\/span>2. Using current_timestamp()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>curent_timestamp() is similar to now() function. Like now() function, it returns the result as YYYY-MM-DD HH-MM-SS string. You can also use current_timestamp() to get latest date and time in MySQL.<\/p>\n\n\n\n<pre id=\"block-e4f8b03a-b370-4eba-9d3e-d45e72875fa0\" class=\"wp-block-preformatted\">mysql&gt; select current_timestamp();\n+---------------------+\n| current_timestamp() |\n+---------------------+\n| 2020-12-21 12:18:33 |\n+---------------------+<\/pre>\n\n\n\n<p>Like now(), you can use interval clause to add\/subtract months, weeks, days, hours, minutes and seconds from the current date returned by current_timestamp().<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_current_date\"><\/span>3. Using current_date<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you only want to get current date in MySQL, you can use system variable <em>current_date<\/em> or functions like curdate() or current_date(). They all give latest date in YYYY-MM-DD format. Here is an example to illustrate it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select current_date,curdate(),current_date();\n+--------------+------------+----------------+\n| current_date | curdate()  | current_date() |\n+--------------+------------+----------------+\n| 2020-12-21   | 2020-12-21 | 2020-12-21     |\n+--------------+------------+----------------+<\/pre>\n\n\n\n<p>Like in case of now(), you can use interval clause to add\/subtract intervals of month, week, day, hour, minute, second from the result of current_date. But in all cases, it will only return a date and not datetime.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select current_date - interval 1 month;<br>+---------------------------------+<br>| current_date - interval 1 month |<br>+---------------------------------+<br>| 2024-06-11                      |<br>+---------------------------------+<br><br>mysql&gt; select current_date + interval 1 month;<br>+---------------------------------+<br>| current_date + interval 1 month |<br>+---------------------------------+<br>| 2024-08-11                      |<br>+---------------------------------+<br><br>mysql&gt; select current_date - interval 1 week;<br>+--------------------------------+<br>| current_date - interval 1 week |<br>+--------------------------------+<br>| 2024-07-04                     |<br>+--------------------------------+<br><br>mysql&gt; select current_date + interval 1 week;<br>+--------------------------------+<br>| current_date + interval 1 week |<br>+--------------------------------+<br>| 2024-07-18                     |<br>+--------------------------------+<br><br>mysql&gt; select current_date - interval 1 day;<br>+-------------------------------+<br>| current_date - interval 1 day |<br>+-------------------------------+<br>| 2024-07-10                    |<br>+-------------------------------+<br><br>mysql&gt; select current_date + interval 1 day;<br>+-------------------------------+<br>| current_date + interval 1 day |<br>+-------------------------------+<br>| 2024-07-12                    |<br>+-------------------------------+<br><br>mysql&gt; select current_date - interval 1 hour;<br>+--------------------------------+<br>| current_date - interval 1 hour |<br>+--------------------------------+<br>| 2024-07-10 23:00:00            |<br>+--------------------------------+<br><br>mysql&gt; select current_date + interval 1 hour;<br>+--------------------------------+<br>| current_date + interval 1 hour |<br>+--------------------------------+<br>| 2024-07-11 01:00:00            |<br>+--------------------------------+<br><br>mysql&gt; select current_date - interval 1 minute;<br>+----------------------------------+<br>| current_date - interval 1 minute |<br>+----------------------------------+<br>| 2024-07-10 23:59:00              |<br>+----------------------------------+<br><br>mysql&gt; select current_date + interval 1 minute;<br>+----------------------------------+<br>| current_date + interval 1 minute |<br>+----------------------------------+<br>| 2024-07-11 00:01:00              |<br>+----------------------------------+<br><br>mysql&gt; select current_date - interval 1 second;<br>+----------------------------------+<br>| current_date - interval 1 second |<br>+----------------------------------+<br>| 2024-07-10 23:59:59              |<br>+----------------------------------+<br><br>mysql&gt; select current_date + interval 1 second;<br>+----------------------------------+<br>| current_date + interval 1 second |<br>+----------------------------------+<br>| 2024-07-11 00:00:01              |<br>+----------------------------------+<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Using_current_time\"><\/span>4. Using current_time<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you only want to get current time in MySQL, you can use system variable <em>current_time<\/em> or functions like curtime() or current_time(). They all give latest time in HH:MM:SS format<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select current_time,curtime(),current_time();\n+--------------+-----------+----------------+\n| current_time | curtime() | current_time() |\n+--------------+-----------+----------------+\n| 12:24:41     | 12:24:41  | 12:24:41       |\n+--------------+-----------+----------------+\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>MySQL provides predefined functions as well as system variables to give you current date and time. You can use either of them as per your requirement. You can also add or subtract months, weeks, days, hours, minutes and seconds from the result of these functions and system variables, if you want to calcualte a datetime value using the current datetime as baseline.<\/p>\n\n\n\n<p>Need a reporting tool for MySQL? <a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>&nbsp;makes it easy to visualize data in minutes, and monitor in real-time dashboards.&nbsp;<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a>&nbsp;Today!<\/p>\n\n\n\n<p>Also read:<br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-group-by-month-in-mysql\/\">How to Group By Month in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-not-null-constraint-in-mysql\/\">How to Remove Not Null Constraint in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-default-value-of-column-in-mysql\/\">How to Remove Default Column Value in MySQL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.<\/p>\n","protected":false},"author":1,"featured_media":8458,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324],"tags":[460,461],"class_list":["post-8455","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-current-date","tag-current-time"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Get Current Date and Time in MySQL - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get Current Date and Time in MySQL - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-21T07:11:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-29T05:53:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"730\" \/>\n\t<meta property=\"og:image:height\" content=\"410\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Get Current Date and Time in MySQL\",\"datePublished\":\"2020-12-21T07:11:00+00:00\",\"dateModified\":\"2025-08-29T05:53:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/\"},\"wordCount\":543,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1\",\"keywords\":[\"current date\",\"current time\"],\"articleSection\":[\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/\",\"name\":\"How to Get Current Date and Time in MySQL - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1\",\"datePublished\":\"2020-12-21T07:11:00+00:00\",\"dateModified\":\"2025-08-29T05:53:47+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1\",\"width\":730,\"height\":410,\"caption\":\"get current date and time in mysql\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-get-current-date-and-time-in-mysql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Get Current Date and Time in MySQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Get Current Date and Time in MySQL - Ubiq BI","description":"Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.","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:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/","og_locale":"en_US","og_type":"article","og_title":"How to Get Current Date and Time in MySQL - Ubiq BI","og_description":"Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-12-21T07:11:00+00:00","article_modified_time":"2025-08-29T05:53:47+00:00","og_image":[{"width":730,"height":410,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp","type":"image\/webp"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Get Current Date and Time in MySQL","datePublished":"2020-12-21T07:11:00+00:00","dateModified":"2025-08-29T05:53:47+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/"},"wordCount":543,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1","keywords":["current date","current time"],"articleSection":["MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/","name":"How to Get Current Date and Time in MySQL - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1","datePublished":"2020-12-21T07:11:00+00:00","dateModified":"2025-08-29T05:53:47+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes you may need to get date from datetime, or get current datetime. Here is how to get current date and time in MySQL.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1","width":730,"height":410,"caption":"get current date and time in mysql"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Get Current Date and Time in MySQL"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/mysql-get-current-date-and-time.webp?fit=730%2C410&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-2cn","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=8455"}],"version-history":[{"count":3,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8455\/revisions"}],"predecessor-version":[{"id":9366,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8455\/revisions\/9366"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/8458"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=8455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=8455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=8455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}