ST_duration

更新时间:
复制 MD 格式

Returns the duration of a trajectory object.

Syntax

interval ST_duration(trajectory traj);

Parameters

ParameterDescription
trajThe trajectory object.

Examples

The following example returns the total travel 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 means the trajectory spans 42 minutes and 10 seconds.