> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/now.md).

# NOW

## Syntax

```bnf
NOW([precision])
CURRENT_TIMESTAMP
CURRENT_TIMESTAMP([precision])
LOCALTIME
LOCALTIME([precision])
LOCALTIMESTAMP
LOCALTIMESTAMP([precision])
```

![Railroad diagram of NOW and synonyms — equivalent to the BNF above](/files/iYESJsYIsxPM5nGS3kam)

## Description

Returns the current date and time as a value in `YYYY-MM-DD HH:MM:SS` or `YYYYMMDDHHMMSS.uuuuuu` format, depending on whether the function is used in a string or numeric context. The value is expressed in the current [time zone](/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones.md).

**MariaDB starting with** [**11.7**](/docs/release-notes/community-server/old-releases/11.7/what-is-mariadb-117.md)

{% tabs %}
{% tab title="Current" %}
These functions return SQL standard compliant types:

* `NOW()` and `CURRENT_TIMESTAMP()` return a `TIMESTAMP` value (analogous to the standard type `TIMESTAMP WITH LOCAL TIME ZONE`) which corresponds to the current point in time and is unambiguous around DST changes.
* `LOCALTIMESTAMP` returns a `DATETIME` value (analogous to the standard type `TIMESTAMP WITHOUT TIME ZONE`). Storing its result in a `TIMESTAMP` column can result in a data loss around DST changes.
  {% endtab %}

{% tab title="< 11.7" %}
These functions do **not** return SQL standard compliant types:

* `NOW()`
* `CURRENT_TIMESTAMP()`
* `LOCALTIMESTAMP`
  {% endtab %}
  {% endtabs %}

The optional *precision* determines the microsecond precision. See [Microseconds in MariaDB](/docs/server/reference/sql-functions/date-time-functions/microseconds-in-mariadb.md).

`NOW()` (or its synonyms) can be used as the default value for [TIMESTAMP](/docs/server/reference/data-types/date-and-time-data-types/timestamp.md) columns as well as.

When displayed in the [INFORMATION\_SCHEMA.COLUMNS](/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-columns-table.md) table, a default [CURRENT TIMESTAMP](/docs/server/reference/sql-functions/date-time-functions/current_timestamp.md) is displayed as `current_timestamp()` .

Changing the [timestamp system variable](/docs/server/server-management/variables-and-modes/server-system-variables.md#timestamp) with a [SET](/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set.md) `timestamp` statement affects the value returned by `NOW()`, but not by [SYSDATE()](/docs/server/reference/sql-functions/date-time-functions/sysdate.md).

## Examples

```sql
SELECT NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2010-03-27 13:13:25 |
+---------------------+

SELECT NOW() + 0;
+-----------------------+
| NOW() + 0             |
+-----------------------+
| 20100327131329.000000 |
+-----------------------+
```

With precision:

```sql
SELECT CURRENT_TIMESTAMP(2);
+------------------------+
| CURRENT_TIMESTAMP(2)   |
+------------------------+
| 2018-07-10 09:47:26.24 |
+------------------------+
```

Used as a default TIMESTAMP:

```sql
CREATE TABLE t (createdTS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);
```

```sql
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='test'
  AND COLUMN_NAME LIKE '%ts%'\G
*************************** 1. row ***************************
           TABLE_CATALOG: def
            TABLE_SCHEMA: test
              TABLE_NAME: t
             COLUMN_NAME: ts
        ORDINAL_POSITION: 1
          COLUMN_DEFAULT: current_timestamp()
...
```

## See Also

* [Microseconds in MariaDB](/docs/server/reference/sql-functions/date-time-functions/microseconds-in-mariadb.md)
* [timestamp server system variable](/docs/server/server-management/variables-and-modes/server-system-variables.md#timestamp)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
