MONTH

From SQLZOO
Revision as of 11:26, 16 July 2012 by Connor (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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 eclipse
SELECT MONTH(whn) AS v, whn, wht
  FROM eclipse

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense