Reputation: 1213
When inserting now()
in a table, the written value only contains the date (e.g. 2017-12-20), but not the date and time as specified in the documentation.
See this SQLfiddle.
create table timetest (
id serial primary key,
mydate date
);
insert into timetest (mydate) values (
now());
Is there some specific command that should be passed to either write or retrieve also the time information?
Upvotes: 0
Views: 536
Reputation: 254886
You created mydate date
as a date
type column. date
only represents the date fraction (unsurprisingly).
If you need both date and time use timestamp
type instead.
References:
Upvotes: 2