0

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))
riki
  • 1,502
  • 5
  • 17
  • 45

1 Answers1

1

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:

  • Update configuration of SQL server instance. See this - this may require Operations/MIS support.
  • Use datetimeoffset on GetUTCDate(). See this.

P.S.: Kindly change the tag of this question to t-sql or sql-server!

Code Maverick
  • 326
  • 2
  • 6