3

Does Anyone know from where GETDATE() gets the DATE itself?

UserID0908
  • 98
  • 1
  • 15
Golipz
  • 53
  • 6
  • 2
    From the server. – Gordon Linoff Dec 21 '17 at 03:04
  • if i using localhost as server, is that mean getdate use my localhost date as the date? – Golipz Dec 21 '17 at 03:08
  • refer to https://learn.microsoft.com/en-us/sql/t-sql/functions/getdate-transact-sql `Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running` – Squirrel Dec 21 '17 at 03:16
  • thanks dude , thats help me a lot @Squirrel – Golipz Dec 21 '17 at 03:20

1 Answers1

4

Good Question.

The GETDATE() function get the DATETIME from the server which is connect.

If you connect you localhost then get it from your local machine.

Otherwise you connect any server, it get the DATETIME from the SERVER you are connect.

Hope this helps you:

You can use DATEADD function:

SELECT DATEADD(DAY,3,GETDATE())
DineshDB
  • 5,998
  • 7
  • 33
  • 49
  • thanks for answer bro. but one more question still buzzing in my head hahaha, is there any possibilities if i set date on my computer to 3 day further and my program which use localhost as server and it run GETDATE() , read the date+3 as the current date? – Golipz Dec 21 '17 at 03:13