Code has been added to clipboard!

How to Use SQL NOW to Retrieve Date or Time

Reading time 1 min
Published Aug 9, 2017
Updated Oct 11, 2019

SQL NOW Function: Main Tips

  • This function brings back the present date/time of the system.
  • In other systems there are various alternatives to this function/

Syntax of SQL NOW

Example
SELECT NOW() FROM tbl_name;

Demo Database

The example table "Products":

ID Name Supplier_ID Category_ID Unit Price Unit_in_stock Unit_on_order
1 Cucumber 3 3 5 crates 19 17 16
2 Tomato 3 3 6 crates 20 24 Null
3 Cheese 3 4 5 kg boxes 11 11 6
4 Milk 4 4 5 L bottles 22 56 12
5 Bread 4 4 36 boxes 26 26 1

SQL NOW: Example

The code example below pick out the "Name" and "Price" for present day in the table "Products":

Example
SELECT Name, Price, Now() AS PerDate
FROM Products;

SQLite Syntax: Example

Example
SELECT Name, Price, strftime('%Y-%m-%d','now') AS PerDate
FROM Products;
Learn SQL
Introduction
Syntax
Data Types
Server Data Types
Commands
Commands List
Wildcards
Constraints
Aggregate Functions
Date Functions
Date Format
Injection
SQL Server Hosting
Views
Auto-incrementation
SQL Operators
AS
AND & OR
IN
BETWEEN
WHERE
GROUP BY
HAVING
ORDER BY
LIKE
NOT
NOT EQUAL
UNION
NULL
NOT NULL
DEFAULT
UNIQUE
FOREIGN KEY
PRIMARY KEY
CHECK
Indexes
ALTER TABLE
CREATE DATABASE
CREATE TABLE
DELETE
DROP
INSERT INTO SELECT
INSERT INTO
SELECT
SELECT DISTINCT
SELECT INTO
SELECT TOP
UPDATE
FULL OUTER JOIN
INNER JOIN
JOIN
LEFT JOIN
RIGHT JOIN
AVG()
COUNT
FIRST
LAST
MAX
MIN()
SUM()
LEN
UCASE
MID
NOW
ROUND
FORMAT
LOWER
CONVERT
ISNULL