Reputation: 381
How to insert data and time in database column.
create table test(sno integer,name varchar,createdtime timestamp);
insert into test values(1,'ASD',to_date('22/08/2015 8:30:00 AM','DD/MON/YY HH:MI:SS AM);
But when i run the same above query in sqlfiddle its showing to_date is not recognized function. Please suggest how can I insert date and time in database table.
Upvotes: 0
Views: 940
Reputation: 187
you should use like this with Postgre/Oracle:
create table test(sno integer,name varchar,createdtime timestamp);
insert into test values(1,'ASD',to_date('22/08/2015 8:30:00 AM','DD/MM/YY HH:MI:SS AM'));
'MM' is the month with number 1-12, Mon is the abbr of month like Jan. DD/MM/YY HH:MI:SS AM
is ok.
Upvotes: 1