MySQL CURDATE Function Introduction If used in a string context or the YYYMMDD format in a numeric context, the CURDATE() function returns the current date as a value in the "YYYY-MM-DD" format. The following example shows how to use the CURDATE() function in a string context. sql> SELECT CURDATE(); +------------+ | CURDATE() | +------------+ | 2017-08-10 | +------------+ 1 row in set (0.00 sec) The following example shows how the CURDATE() function is used in a numeric context: mysql> SELECT CURDATE() + 0; +---------------+ | CURDATE() + 0 | +---------------+ | 20170810 | +---------------+ 1 row in set CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE(). mysql> SELECT CURRENT_DATE(), CURRENT_DATE, CURDATE(); +----------------+--------------+------------+ | CURRENT_DATE() | CURRENT_DATE | CURDATE() | +----------------+--------------+------------+ | 2017-08-10 | 2017-08-10 | 2017-08-10 | +----------------+--------------+------------+ 1 row in set CURDATE and NOW Functions The CURDATE() function returns only the current date, whereas the NOW() function returns both the date and time portion of the current time. The result of the CURDATE() function is equivalent to the following expression: mysql> SELECT DATE(NOW()); +-------------+ | DATE(NOW()) | +-------------+ | 2017-08-10 | +-------------+ 1 row in set In this tutorial, you have learned how to use the MySQL CURDATE() function to get the current date value. If you have any questions, please leave a message or come to the community of this site to communicate and discuss. Thank you for reading and I hope this can be helpful to everyone. Thank you for your support of this site! You may also be interested in:
|
<<: Detailed explanation of the use of Refs in React's three major attributes
>>: Explanation of the steps for Tomcat to support https access
Preface At first, I wanted to use wget to downloa...
I chose node.js to build the server. Friends who ...
Preface When I went to an interview at a company ...
First, let's introduce several common operati...
The role of virtual DOM First of all, we need to ...
Table of contents Component Design Defining the f...
This article shares the installation tutorial of ...
Structure related tags ---------------------------...
This article shares the specific code of JS to ac...
Everything is a file! UNIX has already said it. E...
.NET SDK Download Link https://dotnet.microsoft.c...
Table of contents What is MySQL NDB Cluster Preli...
Operation effectCode Implementation html <div ...
1. Requirements: Database backup is particularly ...
1.mysql-5.7.19-winx64.zip (this is the free insta...