What is NOW() in SQL?

The NOW() function returns the configured timezone’s current date and time.

Figure 1 shows a visual representation of the NOW() function.

Figure 1: Visual representation of NOW() function

Syntax

NOW()

Parameter

The NOW() function does not take in any parameters.

Return value

The NOW() function returns the current date and time.

Its output type depends on the context where it is used. For instance:

-- 1
SELECT NOW();
-- returns string in the format of YYYY-MM-DD HH:MM:DD.

-- 2
SELECT NOW() + 2;
-- returns number in the format of YYYYMMDDHHMMSS.uuuu

When adding or subtracting a number after NOW(), like so: SELECT NOW() + n, the output will have n seconds added on to the time.

When multiplying or dividing after NOW(), like so:
SELECT NOW()/n, the entire number will be multiplied or divided by n.

Example

-- output type as string
SELECT NOW();
-- output type as number plus add two seconds to current date and time
SELECT NOW() + 2;
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
šŸ† Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources