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
| Parameter | Description |
|---|---|
raster_obj | The raster to modify. |
band | The sequence number of the band. Valid values start from 0. |
time | The time to assign to the specified band. Use the yyyy-MM-dd HH:mm:ss format. Example: 2020-08-30 18:00:00. |
start | The start time to assign to the raster. Use the yyyy-MM-dd HH:mm:ss format. |
end | The 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 2020See also
ST_DateTime — reads the time information of a raster or band