Reputation: 1715
Hi the query below performs an insert on sql server, when the insert is done date minutes and seconds are correct but the time is wrong (if there are 8 and I insert an insert the value is saved 7) the format of the hours is that Italian, below the sql code that executes the insert. How do I solve this?
Sql Server:
Insert into Magazzino(Nome,Indirizzo,DataCreazione)
values(@Nome,@Indirizzo,convert(datetime, GETDATE(),105))
Upvotes: 0
Views: 1548
Reputation: 338
Documentation states that GETDATE()
stores the date and time of the computer on which the instance of SQL server is running. To resolve this, you have two options:
datetimeoffset
on GetUTCDate()
. See this.P.S.: Kindly change the tag of this question to t-sql or sql-server!
Upvotes: 1