NOW

Updated at:

Returns the current system time as a TIMESTAMP value.

Syntax

TIMESTAMP NOW()

Parameters

None.

Return value

Returns a TIMESTAMP representing the current time in the time zone of the session or project.

Usage notes

  • The return value reflects the time zone of the session or project, which you can set using the odps.sql.timezone session property.

  • Trailing zeros in the millisecond part are omitted:

    • 000 ms → 0

    • x00 ms → x

    • xx0 ms → xx

  • To use DATE_FORMAT with the return value, enable Data Types 2.0 first.

Examples

The following examples use 2025-09-23 14:14:24.969 (UTC+8) as the current system time.

Return the current time in the session time zone

-- Set the time zone to Asia/Shanghai.
SET odps.sql.timezone=Asia/Shanghai;
-- Returns 2025-09-23 14:14:24.969.
SELECT NOW();

Format the output with DATE_FORMAT

This example requires Data Types 2.0.
-- Enable Data Types 2.0.
SET odps.sql.type.system.odps2 = true;

-- Set the time zone to Etc/GMT.
SET odps.sql.timezone=Etc/GMT;
-- Returns 20250923 06:14:24.969.
SELECT DATE_FORMAT(NOW(), 'yyyyMMdd hh:mm:ss.ff3');

What's next

NOW is a date and time function. For other date calculation and conversion functions, see Date functions.