ST_duration

更新时间:
复制 MD 格式

Returns the duration of a trajectory object as a PostgreSQL interval value.

Syntax

interval ST_duration(trajectory traj);

Parameters

ParameterDescription
trajThe trajectory object.

Return value

Returns an interval value representing the elapsed time from the start to the end of the trajectory.

Examples

The following example queries the duration of the trajectory with ID 2.

SELECT st_duration(traj) FROM traj WHERE id = 2;

Output:

 st_duration
-------------
 00:42:10
(1 row)

The result 00:42:10 indicates that the trajectory spans 42 minutes and 10 seconds.