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
Table of contents Install: 1. Basic use of firewa...
Getting Started with Data Volumes In the previous...
1 Pull the image from hup docker pull nginx 2 Cre...
In JavaScript's DOM event model, events are r...
Description: Set a timer to replace the content of...
A few days ago, I watched a video of a foreign gu...
Table of contents 1. Index Basics 1.1 Introductio...
A Brief Discussion on the Navigation Window in If...
Preface Recently, many new colleagues have asked ...
Table of contents npm Install the loader Import P...
Table of contents 1. Introduction 2. Principle II...
I designed and customized a navigation bar with a...
Recently, I encountered a database with the follo...
Preface This article mainly introduces the releva...
MySQL5.6 How to create SSL files Official documen...