Question

Get the day of the month from the timestamp '2012-08-31' as an integer.
Schema reminder
DB schema

Expected Results

date_part
31

Your Answer Hint Help Save Run Query

 

Answers and Discussion Show

select extract(day from timestamp '2012-08-31');          

The EXTRACT function is used for getting sections of a timestamp or interval. You can get the value of any field in the timestamp as an integer.

The easiest way to do this is with the EXTRACT function.

Keyboard shortcuts:


Other hints: