{"id":6285,"date":"2017-07-13T05:06:05","date_gmt":"2017-07-13T12:06:05","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=6285"},"modified":"2023-10-18T03:15:15","modified_gmt":"2023-10-18T10:15:15","slug":"mysql-sysdate","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-date-functions\/mysql-sysdate\/","title":{"rendered":"MySQL SYSDATE Function"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn about the MySQL <code>SYSDATE()<\/code> function and its caveat.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL SYSDATE() function<\/h2>\n\n\n\n<p>The <code>SYSDATE()<\/code> function returns the current <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-date\/\">date<\/a> and <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-time\/\">time<\/a> at which it is executed. If you use the function in the string context, the return value in the <code>'YYYY-MM-DD HH:MM:SS'<\/code> format. However, if you use the function in a numeric context, it returns a value in the <code>YYYYMMDDHHMMSS<\/code> format.<\/p>\n\n\n\n<p>Here&#8217;s the basic syntax of the <code>SYSDATE()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">SYSDATE(fsp);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>SYSDATE()<\/code> function accepts an optional argument <code>fsp<\/code> that determines whether the result should include a fractional seconds precision which ranges from 0 to 6.<\/p>\n\n\n\n<p>See the following example:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">SELECT SYSDATE();<\/code><\/span><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">---------------------+<\/span>\n| SYSDATE()           |\n+<span class=\"hljs-comment\">---------------------+<\/span>\n| 2017-07-13 17:42:37 |\n+<span class=\"hljs-comment\">---------------------+<\/span>\n1 row in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you pass the <code>fsp<\/code> argument, the result will include the fractional seconds precision as shown in the following example:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">SELECT SYSDATE(3);<\/code><\/span><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">-------------------------+<\/span>\n| SYSDATE(3)              |\n+<span class=\"hljs-comment\">-------------------------+<\/span>\n| 2017-07-13 17:42:55.875 |\n+<span class=\"hljs-comment\">-------------------------+<\/span>\n1 row in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">SYSDATE vs. NOW<\/h2>\n\n\n\n<p>The following example uses the <code>SYSDATE()<\/code> and <code>NOW()<\/code> functions in the same query:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">SELECT \n  SYSDATE(), \n  NOW();<\/code><\/span><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">---------------------+---------------------+<\/span>\n| SYSDATE()           | NOW()               |\n+<span class=\"hljs-comment\">---------------------+---------------------+<\/span>\n| 2017-07-13 17:46:30 | 2017-07-13 17:46:30 |\n+<span class=\"hljs-comment\">---------------------+---------------------+<\/span>\n1 row in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It seems that both <code>SYSDATE()<\/code> and <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-date-functions\/mysql-now-function\/\">NOW()<\/a><\/code> functions return the same value which is the current date and time at which it is executed.<\/p>\n\n\n\n<p>However, the <code>SYSDATE()<\/code> function actually returns the time at which it executes while the <code>NOW()<\/code> function returns a constant time at which the statement began to execute. For example:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">SELECT \n  NOW(), \n  SLEEP(5), \n  NOW();<\/code><\/span><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">---------------------+----------+---------------------+<\/span>\n| NOW()               | SLEEP(5) | NOW()               |\n+<span class=\"hljs-comment\">---------------------+----------+---------------------+<\/span>\n| 2017-07-13 17:49:18 |        0 | 2017-07-13 17:49:18 |\n+<span class=\"hljs-comment\">---------------------+----------+---------------------+<\/span>\n1 row in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">5.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we use the <code>SLEEP()<\/code> function to pause the query for 5 seconds. Within the same statement, the <code>NOW()<\/code> function always returns a constant which is the time at which the statement starts.<\/p>\n\n\n\n<p>Let&#8217;s change the <code>NOW()<\/code> function to <code>SYSDATE()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">SELECT \n  SYSDATE(), \n  SLEEP(5), \n  SYSDATE();<\/code><\/span><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">---------------------+----------+---------------------+<\/span>\n| SYSDATE()           | SLEEP(5) | SYSDATE()           |\n+<span class=\"hljs-comment\">---------------------+----------+---------------------+<\/span>\n| 2017-07-13 17:50:57 |        0 | 2017-07-13 17:51:02 |\n+<span class=\"hljs-comment\">---------------------+----------+---------------------+<\/span>\n1 row in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">5.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Within the same statement, <code>SYSDATE()<\/code> function returns different time values that reflect the time at which the <code>SYSDATE()<\/code> function was executed.<\/p>\n\n\n\n<p>Because the <code>SYSDATE()<\/code> function is non-deterministic, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-create-index\/\">indexes<\/a> cannot be utilized for evaluating expressions that refer to it.<\/p>\n\n\n\n<p>To demonstrate this, we will <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">create a table<\/a> named <code>tests<\/code> and <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert\/\">insert some data<\/a> into this table.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> tests (\n    <span class=\"hljs-keyword\">id<\/span> <span class=\"hljs-built_in\">INT<\/span> AUTO_INCREMENT PRIMARY <span class=\"hljs-keyword\">KEY<\/span>,\n    t DATETIME <span class=\"hljs-keyword\">UNIQUE<\/span>\n);\n\n<span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> tests(t) \n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">RECURSIVE<\/span> times(t) <span class=\"hljs-keyword\">AS<\/span>\n( \n    <span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">now<\/span>() - <span class=\"hljs-built_in\">interval<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">YEAR<\/span> t\n        <span class=\"hljs-keyword\">UNION<\/span> <span class=\"hljs-keyword\">ALL<\/span> \n    <span class=\"hljs-keyword\">SELECT<\/span> t + <span class=\"hljs-built_in\">interval<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">hour<\/span>\n    <span class=\"hljs-keyword\">FROM<\/span> times\n    <span class=\"hljs-keyword\">WHERE<\/span> t &lt; <span class=\"hljs-keyword\">now<\/span>() \n)\n<span class=\"hljs-keyword\">SELECT<\/span> t\n<span class=\"hljs-keyword\">FROM<\/span> times;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice that we used a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-recursive-cte\/\">recursive CTE<\/a> for generating time series. The CTE has been available since MySQL 8.0<\/p>\n\n\n\n<p>Because the <code>t<\/code> column has a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-unique\/\">unique index<\/a>, the following query should execute fast:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    <span class=\"hljs-keyword\">id<\/span>, \n    t\n<span class=\"hljs-keyword\">FROM<\/span>\n    tests\n<span class=\"hljs-keyword\">WHERE<\/span>\n    t &gt;= <span class=\"hljs-keyword\">SYSDATE<\/span>() - <span class=\"hljs-built_in\">INTERVAL<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">DAY<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>However, it took 15ms to complete. Let&#8217;s see the detail using the <code>EXPLAIN<\/code> statement.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">EXPLAIN<\/span> <span class=\"hljs-keyword\">SELECT<\/span> \n    <span class=\"hljs-keyword\">id<\/span>, t\n<span class=\"hljs-keyword\">FROM<\/span>\n    tests\n<span class=\"hljs-keyword\">WHERE<\/span>\n    t &gt;= <span class=\"hljs-keyword\">SYSDATE<\/span>() - <span class=\"hljs-built_in\">INTERVAL<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">DAY<\/span>;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"742\" height=\"36\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png\" alt=\"MySQL SYSDATE - SYSDATE function\" class=\"wp-image-6286\" title=\"MySQL SYSDATE - SYSDATE function\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png 742w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function-300x15.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p>It turned out that MySQL had to scan all the rows in the table to get the data. The index could not utilized.<\/p>\n\n\n\n<p>If you change the <code>SYSDATE()<\/code> to <code>NOW()<\/code> function in the query:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    <span class=\"hljs-keyword\">id<\/span>, \n    t\n<span class=\"hljs-keyword\">FROM<\/span>\n    tests\n<span class=\"hljs-keyword\">WHERE<\/span>\n    t &gt;= <span class=\"hljs-keyword\">NOW<\/span>() - <span class=\"hljs-built_in\">INTERVAL<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">DAY<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>With the <code>NOW()<\/code> function, the index has been used for querying data as demonstrated in the result of the <code>EXPLAIN<\/code> statement below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">EXPLAIN<\/span> <span class=\"hljs-keyword\">SELECT<\/span> \n    <span class=\"hljs-keyword\">id<\/span>, \n    t\n<span class=\"hljs-keyword\">FROM<\/span>\n    tests\n<span class=\"hljs-keyword\">WHERE<\/span>\n    t &gt;= <span class=\"hljs-keyword\">NOW<\/span>() - <span class=\"hljs-built_in\">INTERVAL<\/span> <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">DAY<\/span>;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"40\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-NOW-function.png\" alt=\"MySQL SYSDATE - NOW function\" class=\"wp-image-6287\" title=\"MySQL SYSDATE - NOW function\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-NOW-function.png 748w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-NOW-function-300x16.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/figure>\n\n\n\n<p>Note that MySQL provides you with the&nbsp;<code>--sysdate-is-now<\/code>&nbsp;option that can make the&nbsp;<code>SYSDATE()<\/code>&nbsp;function behaves the same as the&nbsp;<code>NOW()<\/code>&nbsp;function.<\/p>\n\n\n\n<p>In this tutorial, you have learned about the MySQL <code>SYSDATE()<\/code> function and the reasons why you should consider using it.<\/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=\"6285\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-date-functions\/mysql-sysdate\/\"\n\t\t\t\tdata-post-title=\"MySQL SYSDATE Function\"\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=\"6285\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-date-functions\/mysql-sysdate\/\"\n\t\t\t\tdata-post-title=\"MySQL SYSDATE Function\"\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>In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":7032,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6285","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>MySQL SYSDATE() Function<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL SYSDATE() Function\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-18T10:15:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/\",\"name\":\"MySQL SYSDATE() Function\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/MySQL-SYSDATE-SYSDATE-function.png\",\"datePublished\":\"2017-07-13T12:06:05+00:00\",\"dateModified\":\"2023-10-18T10:15:15+00:00\",\"description\":\"In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/MySQL-SYSDATE-SYSDATE-function.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/MySQL-SYSDATE-SYSDATE-function.png\",\"width\":742,\"height\":36,\"caption\":\"MySQL SYSDATE - SYSDATE function\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-sysdate\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Date Functions\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-date-functions\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL SYSDATE Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?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":"MySQL SYSDATE() Function","description":"In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.","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:\/\/www.mysqltutorial.org\/mysql-sysdate\/","og_locale":"en_US","og_type":"article","og_title":"MySQL SYSDATE() Function","og_description":"In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-10-18T10:15:15+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/","url":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/","name":"MySQL SYSDATE() Function","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png","datePublished":"2017-07-13T12:06:05+00:00","dateModified":"2023-10-18T10:15:15+00:00","description":"In this tutorial, you will learn how to use the MySQL SYSDATE() function to get the current date and time at which it is executed.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-sysdate\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2017\/07\/MySQL-SYSDATE-SYSDATE-function.png","width":742,"height":36,"caption":"MySQL SYSDATE - SYSDATE function"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-sysdate\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Date Functions","item":"https:\/\/www.mysqltutorial.org\/mysql-date-functions\/"},{"@type":"ListItem","position":3,"name":"MySQL SYSDATE Function"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=6285"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6285\/revisions"}],"predecessor-version":[{"id":11390,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6285\/revisions\/11390"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7032"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=6285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}