I have an mobile application that make a insert in a Postgres database via JDBC. In the database table, i have a timestamp column and I need to insert the real timestamp of the server, to ensure that no one is inserting a fake date/time. It will be something like:
INSERT INTO some_table VALUES(...,now());
This code seems right, but if the mobile device have a different timezone, this difference reflect in the now() function. Example:
Date/time of server: 00:00:00 -04
Date/time of mobile: 00:12:34 +00
Result of insert above: 04:00:00
I already tried some other approaches, like:
INSERT INTO some_table VALUES(...,now()::timestamp)
INSERT INTO some_table VALUES(...,current_timestamp)