All Products
Search
Document Center

ApsaraDB RDS:ST_DateTime

Last Updated:Mar 28, 2026

Returns the time information of a raster object or a specific band.

Syntax

text ST_DateTime(raster raster_obj);
timestamp ST_DateTime(raster raster_obj, integer band);

Parameters

ParameterDescription
raster_objThe raster object to query.
bandThe index of the band whose time information to return. Valid values start from 0.

Description

ST_DateTime has two overloads with different return types:

  • Without `band`: Returns a text value — a JSON object that maps each band index to its timestamp string. Keys are band indexes represented as strings ("0", "1", ...), and values are timestamps in PostgreSQL's default text format (for example, "Mon Dec 31 00:00:00 2018").

  • With `band`: Returns a single timestamp value for the specified band. Band indexes start at 0.

Examples

Get timestamps for all bands

SELECT ST_DateTime(raster_obj)
FROM raster_table;

Output:

{"0":"Mon Dec 31 00:00:00 2018","1":"Mon Dec 31 01:00:00 2018","2":"Mon Dec 31 02:00:00 2018","3":"Mon Dec 31 03:00:00 2018","4":"Mon Dec 31 04:00:00 2018","5":"Mon Dec 31 05:00:00 2018","6":"Mon Dec 31 06:00:00 2018","7":"Mon Dec 31 07:00:00 2018","8":"Mon Dec 31 08:00:00 2018","9":"Mon Dec 31 09:00:00 2018","10":"Mon Dec 31 10:00:00 2018","11":"Mon Dec 31 11:00:00 2018","12":"Mon Dec 31 12:00:00 2018","13":"Mon Dec 31 13:00:00 2018","14":"Mon Dec 31 14:00:00 2018","15":"Mon Dec 31 15:00:00 2018","16":"Mon Dec 31 16:00:00 2018","17":"Mon Dec 31 17:00:00 2018","18":"Mon Dec 31 18:00:00 2018","19":"Mon Dec 31 19:00:00 2018","20":"Mon Dec 31 20:00:00 2018","21":"Mon Dec 31 21:00:00 2018","22":"Mon Dec 31 22:00:00 2018","23":"Mon Dec 31 23:00:00 2018"}

Get the timestamp for a specific band

SELECT ST_DateTime(raster_obj, 0)
FROM raster_table;

Output:

"Mon Dec 31 00:00:00 2018"