Get the day of the month from a timestamp

Question

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

Expected Results

extract
31

Your Answer

Your Results

Loading database...

Answers and Discussion

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.