Back to cookbooks list Articles Cookbook

How to Get the Current Date in SQLite

  • DATE(‘now’)
  • DATE()

Table of Contents

Problem:

You’d like to get the current date in an SQLite database.

Solution:

We’ll use the function DATE() to get the current date.

SELECT DATE('now');

Here’s the result of the query:

2019-10-15

Discussion:

The SQLite function DATE('now') returns the current date as a text value. It uses the YYYY-MM-DD format, where YYYY is a 4-digit year, MM is a 2-digit month, and DD is a 2-digit day of the month.

This function takes one argument: the text 'now' indicates the current date and time. However, you don’t have to add it, as 'now' is the default. You can just use:

SELECT DATE();

Recommended courses:

Recommended articles:

See also: