Difference between revisions of "SQL - Extract month from current date"

(Created page with "If you want to extract the month of the current date directly, then use ''CURRENT_TIMESTAMP'' <pre>SELECT EXTRACT(MONTH FROM CURRENT_TIMESTAMP)</pre> Category: SQL")
 
 
Line 2: Line 2:
  
 
<pre>SELECT EXTRACT(MONTH FROM CURRENT_TIMESTAMP)</pre>
 
<pre>SELECT EXTRACT(MONTH FROM CURRENT_TIMESTAMP)</pre>
 +
 +
EXTRACT() is a SQL standard function supported by MySQL, Oracle, and PostgreSQL Databases.
 
[[Category: SQL]]
 
[[Category: SQL]]

Latest revision as of 15:08, 6 October 2019

If you want to extract the month of the current date directly, then use CURRENT_TIMESTAMP

SELECT EXTRACT(MONTH FROM CURRENT_TIMESTAMP)

EXTRACT() is a SQL standard function supported by MySQL, Oracle, and PostgreSQL Databases.