All Products
Search
Document Center

MaxCompute:CURRENT_MICROS

Last Updated:Mar 26, 2026

Returns the current time as a BIGINT value in microseconds, adjusted to the specified time zone.

Syntax

BIGINT CURRENT_MICROS([STRING <time_zone>])

-- Example: Returns 62747524000.
SELECT CURRENT_MICROS('Asia/Shanghai');

Parameters

time_zone: Optional. A STRING specifying the time zone. Accepted formats:

FormatExample
IANA time zone nameAsia/Shanghai, Asia/Dhaka
UTC offset (HH:MM)UTC+08:00, UTC+06:00
UTC offset (shorthand)+8, +06

If omitted, the function uses the time zone of the current session or project. The default project time zone is UTC+08:00.

Return value

A BIGINT value representing the current time in microseconds. Returns NULL if the input is NULL.

Usage notes

  • NULL input: Passing NULL as the argument returns NULL, not the default time zone result.

Examples

The following examples use a reference time of 2025-09-24 17:25:18.381 with the project time zone set to Asia/Shanghai.

Example 1: Use the default session or project time zone

-- Returns 62718381000.
SELECT CURRENT_MICROS();

Example 2: Specify a time zone

-- Returns 55518381000 (Bangladesh time, UTC+06:00).
SELECT CURRENT_MICROS('Asia/Dhaka');

-- Equivalent statements using different time zone formats:
-- SELECT CURRENT_MICROS('UTC+06:00');
-- SELECT CURRENT_MICROS('+06');

Example 3: Pass NULL as the argument

-- Returns NULL.
SELECT CURRENT_MICROS(NULL);

Example 4: Convert the result to a formatted string

Use FORMAT_TIME to convert the BIGINT result to a human-readable time string.

-- Returns 17:25:18.381 (Asia/Shanghai time zone).
SELECT FORMAT_TIME(CURRENT_MICROS('Asia/Shanghai'), '%H:%M:%S.ff3');

-- Returns 15:25:18 (Asia/Dhaka time zone).
SELECT FORMAT_TIME(CURRENT_MICROS('Asia/Dhaka'), '%H:%M:%S');

Related functions

CURRENT_MICROS is a time function. For other date and time functions, see Date functions.