INSERT into Group (Name,CreatedDate) VALUES ('Test',UTC_TIMESTAMP(), 1);
This is the query I have used for mysql to insert current date time. When I am using this in postgresql, I am getting below error.
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********
ERROR: function utc_timestamp() does not exist
SQL state: 42883
I have tried like below using now(), however it is inserting like "2016-07-07 17:01:18.410677". I need to insert in 'yyyymmdd hh:mi:ss tt' format.
INSERT into Group (Name,CreatedDate) VALUES ('Test',UTC_TIMESTAMP(), 1);
How to insert current date time in insert query of postgresql in above format ?
CURRENT_TIMESTAMPor evenNOW(). there are at least precision arguments to the former. SoCURRENT_TIMESTAMP(3)will yield 3 subecond digits (milli second resolution)timestampcolumns do not have "a format". Any formatting you see is applied by the SQL client you are using. Change the configuration of your SQL client or use a proper formatting function if you want a different display format.