totn MariaDB Functions

MariaDB: NOW Function

This MariaDB tutorial explains how to use the MariaDB NOW function with syntax and examples.

Description

The MariaDB NOW function returns the current date and time.

Syntax

The syntax for the NOW function in MariaDB is:

NOW( )

Parameters or Arguments

There are no parameters or arguments for the NOW function.

Note

  • The NOW function will return the current date as a 'YYYY-MM-DD HH:MM:SS' format, if used in a string context.
  • The NOW function will return the current date as a YYYYMMDDHHMMSS format, if used in a numeric context.
  • The CURRENT_TIMESTAMP, LOCALTIME, and LOCALTIMESTAMP functions are synonyms for the NOW function.

Applies To

The NOW function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB NOW function examples and explore how to use the NOW function in MariaDB.

For example:

SELECT NOW();
Result: '2014-05-18 10:56:41'

SELECT NOW() + 0;
Result: 20140518105641

SELECT NOW() + 1;
Result: 20140518105642