I've inherited some code that writes rows to a logging table. The table has a TIMESTAMP column named "modified".
The code sets the timestamp field to a value given by the expression:
new java.sql.Timestamp(new java.util.Date().getTime())
When run my code, then log in to the database and examine a newly-inserted row with a query like:
select now(), modified where id = <id-of-row-I-just-inserted>;
I see something like:
NOW() | modified
2017-01-04 23:30:00 | 2017-01-04 15:30:00
The modified column is close to my local time, but the now() column, the server's local time, is eight hours ahead. It would appear that the timestamp I provide to Slick is being converted to a string representing my local time, then that string is being shipped to the server, where it is unpacked into a timestamp that's eight hours old.
Is this what's happening? Is there a different way one is supposed to send a raw, epoch-millisecond timestamp to the server?
Everything I've been able to turn up in a search deals only with defining my tables in such a way that a column like "modified" is automatically timestamped by the server whenever a row is updated (eg "default now()"). But here I have pre-existing tables that have not been defined that way, and I need to explicitly set a timestamp column to the current time. Can it be done?