All Products
Search
Document Center

PolarDB:ST_SetDateTime

Last Updated:Mar 28, 2026

Sets the start and end time of a raster, or the time of a specific band. Returns the modified raster.

Syntax

-- Set the time range of a whole raster
raster ST_setDateTime(raster raster_obj,
                      timestamp start,
                      timestamp end);

-- Set the time of a specific band
raster ST_setDateTime(raster raster_obj,
                      integer band,
                      timestamp time);

Parameters

ParameterDescription
raster_objThe raster to modify.
bandThe sequence number of the band. Valid values start from 0.
timeThe time to assign to the specified band. Use the yyyy-MM-dd HH:mm:ss format. Example: 2020-08-30 18:00:00.
startThe start time to assign to the raster. Use the yyyy-MM-dd HH:mm:ss format.
endThe end time to assign to the raster. Use the yyyy-MM-dd HH:mm:ss format.

Examples

Set a band's time and verify the result

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

Expected output:

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

See also

  • ST_DateTime — reads the time information of a raster or band