How do I insert datetime type on PG database?

This question was asked by Tinh from our discord channel.


Full Question:

User has Input1 on Appsmith: type (HH:mm)
Column Type on DB : type (time)

When performing Insert into ("time") values ('{{input1.text}}')

This gives an error:

Query preparation failed while inserting value: 15:13 for binding: {{input1.text}}. Please check the query again. Error: null

Solution: This DB accepts the DateTime field in the string, so we can use moment to convert the DateTime field, update that default text to following:

INSERT INTO public."TTKHACHHANG" ("sdt", "gio_gian_so")
  VALUES ({{input1.value}},'{{input2.text}}');

Turn off prepared statements.