All Products
Search
Document Center

PolarDB:ST_SetDateTime

Last Updated:Mar 28, 2026

Sets the start and end time of a raster object, or the timestamp of a specific band.

Syntax

raster ST_setDateTime(raster raster_obj,
                      timestamp start,
                      timestamp end);
raster ST_setDateTime(raster raster_obj,
                      integer band,
                      timestamp time);

Parameters

ParameterDescription
raster_objThe raster object to update.
bandThe index of the band to update. Band indexes start at 0.
timeThe timestamp to assign to the specified band. Use the format yyyy-MM-dd HH:mm:ss, for example, 2020-08-30 18:00:00.
startThe start time to assign to the raster. Use the format yyyy-MM-dd HH:mm:ss.
endThe end time to assign to the raster. Use the format yyyy-MM-dd HH:mm:ss.

Examples

The following example sets the timestamp of band 0 to 2020-01-02 and reads it back using ST_DateTime.

select ST_DateTime(ST_setDateTime(raster_obj, 0, '2020-01-02'::timestamp), 0)
FROM raster_table

Output:

       st_datetime
--------------------------
 Thu Jan 02 00:00:00 2020