Skip to content

Commit

Permalink
Add expression functions for handling date/time:
Browse files Browse the repository at this point in the history
    - year,month,day,hour,minute,second extraction
    - new QgsInterval objects - handles time amounts
    - age() function returns the difference between two  datetimes
    - $now returns the current date and time
    - support for datetime - interval = new datetime
    - tointerval, todate, totime functions
    - tests ;)
  • Loading branch information
NathanW2 committed Jun 30, 2012
1 parent 4b81e36 commit c467e79
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 3 deletions.
20 changes: 18 additions & 2 deletions python/core/qgsexpression.sip
@@ -1,4 +1,3 @@

class QgsExpression
{
%TypeHeaderCode
Expand Down Expand Up @@ -304,7 +303,24 @@ public:
virtual void visit( QgsExpression::NodeCondition* n ) = 0;
};

class Interval
{
public:
Interval(int seconds);
~Interval();
int years();
int weeks();
int days();
int hours();
int minutes();
int seconds();
bool isValid();
void setValid(bool valid);
bool operator==(const QgsExpression::Interval& other) const;
static QgsExpression::Interval invalidInterVal();
static QgsExpression::Interval fromString(QString string);
};

/** entry function for the visitor pattern */
void acceptVisitor( QgsExpression::Visitor& v );

};

0 comments on commit c467e79

Please sign in to comment.