I would guess, that embeddet SQL is your best bet for that and then just using SQL to get the date and time (according to https://www.postgresql.org/docs/8.0/...-datetime.html "timeofday()" would give you both)