Reputation: 68
I had this statement for SQLSERVER which inserts into a DateTime column, today's date but a specific hour.
INSERT INTO session VALUES(
SMALLDATETIMEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), DAY(GETDATE()), 12, 0), 1, 1);
I am trying to achieve the same result in PostgreSQL but I can only find this
INSERT INTO sessions VALUES(current_timestamp, 1, 1)
Which inserts the current date and time.
How would I be able to do this in PostgreSQL?
Upvotes: 1
Views: 7927
Reputation: 1270653
You can use:
current_date + interval '12 hour'
Note: When you insert values into a table, you should always list the columns for the insert.
Upvotes: 2