[Qgis-developer] datetime difference between 2 datetimes in Field Calculator
Nathan Woodrow
madmanwoo at gmail.com
Tue May 24 00:27:26 PDT 2016
Win!
On Tue, 24 May 2016 5:21 pm Nyall Dawson <nyall.dawson at gmail.com> wrote:
> On 23 May 2016 at 21:21, Richard Duivenvoorde <richard at duif.net> wrote:
> > Nyall Dawson schreef op 2016-05-23 11:41:
> >>>
> >>> 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!
> >
> >
> > Ah :-) definitely... Did find see that one...
>
> FYI - as of https://github.com/qgis/QGIS/commit/8ddcf76 you can now
> just directly calculate date/time/datetime differences using "-", eg
>
> to_date('2016-03-04')-to_date('2016-03-01')
>
> This will return an interval object which you can then use seconds(),
> minute(), etc on.
>
> Nyall
>
>
> >
> > Thanks!
> >
> > Richard
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160524/fa272996/attachment.html>
More information about the Qgis-developer
mailing list