Difference between revisions of "HOUR"

From SQLZOO
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 34: Line 34:
 
       ,whn
 
       ,whn
 
       ,wht
 
       ,wht
   FROM eclipse
+
   FROM gisq.eclipse
 
</source>
 
</source>
 
<source lang='sql' class='def'>
 
<source lang='sql' class='def'>
Line 51: Line 51:
 
   <li>[[SECOND |SECOND function]]</li>
 
   <li>[[SECOND |SECOND function]]</li>
 
</ul>
 
</ul>
 +
 +
{{Languages}}

Latest revision as of 21:06, 21 October 2012

Compatibility
HOUR(d)
EngineOKAlternative
ingresNoEXTRACT(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(HOUR FROM whn) AS v
      ,whn
      ,wht
  FROM eclipse
SELECT EXTRACT(HOUR FROM whn) AS v
      ,whn
      ,wht
  FROM eclipse
SELECT TO_CHAR(whn,'HOUR') AS v
      ,whn
      ,wht
  FROM gisq.eclipse
SELECT HOUR(whn) AS v, whn, wht
  FROM eclipse

See also

Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense