Book Contents

Book Index

Next Topic

Home

DATE_PART

The DATE_PART function is modeled on the traditional Ingres equivalent to the SQL-standard function EXTRACT:

Syntax

DATE_PART( field , source)

Semantics

 

field

a single-quoted string value that specifies the field to extract.

source

a date/time expression

Notes

Example

SELECT date_part('day', TIMESTAMP '2001-02-16 20:38:40');

Result: 16

SELECT date_part('hour', INTERVAL '4 hours 3 minutes');

Result: 4