Difference between revisions of "MONTH"

From SQLZOO
Jump to: navigation, search
(Created page with "<table align='right' border='1'> <caption>Compatibility</caption> <tr><th colspan='3'>MONTH(d)</th></tr> <tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</t...")
 
Line 28: Line 28:
 
       ,whn
 
       ,whn
 
       ,wht
 
       ,wht
   FROM eclipse
+
   FROM gisq.eclipse
 
</source>
 
</source>
 
<source lang='sql' class='def'>
 
<source lang='sql' class='def'>

Revision as of 13:14, 16 July 2012

Compatibility
MONTH(d)
EngineOKAlternative
ingresYesEXTRACT(HOUR from d)
mysqlYesEXTRACT(HOUR from d)
oracleNoTO_CHAR(d,'HH24')
postgresNoEXTRACT(HOUR from d)
sqlserverYesDATEPART(HOUR,d)

HOUR

HOUR allows you to retrieve the hour from a datetime.

   HOUR(d)

In this example you get the hour from the datetime field whn.

SELECT EXTRACT(MONTH FROM whn) AS v
      ,whn
      ,wht
  FROM eclipse
SELECT TO_CHAR(whn,'MONTH') AS v
      ,whn
      ,wht
  FROM gisq.eclipse
SELECT MONTH(whn) AS v, whn, wht
  FROM eclipse

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense