Let's start with the simplest,
GETDATE(). This function returns a
DATETIME data type, which has fewer fractional seconds and does not include time zone information. Therefore, it's less precise than other functions. Here's how you use this function:
It is very simple, isn't it?
CURRENT_TIMESTAMP function works exactly like
GETDATE(). You don't use brackets with this function—only its name:
Why do we have two functions that do the same thing?
CURRENT_TIMESTAMP follows the ANSI SQL standard;
GETDATE() is the T-SQL version.
It is important to mention that our database has the time zone set to UTC. This means that the time returned by these functions may differ from your local time.