Postgresql Convert Timestamp To Integer Function