Return a comparison object for the year of a datetime variable.
In this context, a datetime variable is any object which has a year attribute.
If value is a cf.Comparison object then cf.year(value) is equivalent to value.addattr('year'). Otherwise cf.year(value) is equivalent to cf.eq(value, attr='year').
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> d = cf.dt(2002, 6, 16)
>>> d == cf.year(2002)
True
>>> d == cf.year(cf.le(2003))
True
>>> d == cf.year(2001)
False
>>> d == cf.year(cf.wi(2003, 2006))
False