Check out example codes for "datepart postgres". It will help you in understanding the concepts better.

Code Example 1

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

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

Learn ReactJs, React Native from akashmittal.com