On 23 May 2016 at 19:12, Richard Duivenvoorde <[email protected]> wrote:
> I have a start-datetime (string) and a an end-datetime (string) in the
> attributes of my vector data.
>
> I can use the  to_datetime(str) function in the Field Calculator to create
> DateTime objects from these.
>
> But now it would be cool to check the time-difference between those two
> (called timespan?).
> I did not find a function for those...

Use the age() function. That takes two datetimes and returns an
interval length between them. You can extract the
seconds/minutes/hours/etc from an interval type using the seconds(),
minutes(), ... etc functions.

Hope that helps!
Nyall



>
> Any hints?
>
> If I did not miss something, I think there is not even a Qt function for
> this...
>
> A function to add could be: 'to_timemillies', then the user could create
> timemillies from the DateTime-objects, and do some calculation on those
> him/herself...
>
> Would that be usefull?
>
> Regards,
>
> Richard Duivenvoorde
> _______________________________________________
> Qgis-developer mailing list
> [email protected]
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to