This topic describes how to use the date function NOW in Realtime Compute.

Syntax

BIGINT NOW()
BIGINT NOW(a)

Input parameters

Parameter Data type
a INT

Description

  • If the input parameter is not specified, the timestamp (in seconds) of the current time zone is returned.
  • You can specify a parameter of the INT type in the parentheses () as the offset (in seconds). This function returns the value of the current timestamp plus the offset. For example, NOW(100) returns a timestamp 100 seconds later than the current timestamp.
    Note If the offset a is null, null is returned.

Example

  • Test data
    Table 1. T1
    a (INT)
    null
  • Test statements
    SELECT 
     NOW() as now,
     NOW(100) as now_100,
     NOW(a) as now_null
    FROM T1;
  • Test results
    now (BIGINT) now_100 (BIGINT) now_null (BIGINT)
    1403006911 1403007011 null