Reputation: 868
I'm running the following command: SET datestyle = 'SQL, DMY'; And then using the datestyle type to create a table. Turns out I get the following message:
[Code: , SQL State: 08006] The server's DateStyle parameter was changed to
SQL, DMY. The JDBC driver requires DateStyle to begin with ISO for correct
operation.
So I've tried SET datestyle = 'ISO, DMY'; This works but it's not working with my table. When I set the type of the column to text I get this:
I want the exact same thing but with datestyle. How can I get this?
Upvotes: 0
Views: 713
Reputation: 45910
I don't understand to JDBC, but this can be done on SQL level via to_timestamp
function:
postgres=# select to_timestamp('13/01/2016 16:28', 'dd/mm/yyyy hh24:mi');
┌────────────────────────┐
│ to_timestamp │
╞════════════════════════╡
│ 2016-01-13 16:28:00+01 │
└────────────────────────┘
(1 row)
So you can pass yours dates to Postgres as string, and the conversation can be done inside Postgres.
Upvotes: 1