Reputation: 539
I have a table in database, one of the row adds add while something was done/acomplished. And it works fine. But.. it doesn't add current time. When I prints out date from db, it shows 2016-12-13 00:00
. Instead of for example 2016-12-13 15:32
. How do I add current time?
This is how my sql looks
[example_date] DATE NOT NULL,
Upvotes: 2
Views: 1300
Reputation: 1269763
The date
data type does not have a time component. You want either datetime
or datetime2
(or perhaps smalldatetime
):
example_datetime DATETIME NOT NULL,
You can review the documentation for the various date/time data types here.
Upvotes: 3