Class or filter expression on date field in shapefile
Ei Fujioka
efujioka at DUKE.EDU
Tue Oct 30 09:03:16 PDT 2007
Thanks, Andreas, for your quick response.
This is exactly what I wanted to know.
It seems Mapserver 4.2 doesn't treat backticks as a date type value,
though. So definitely need to upgrade.
Meanwhile I think I should stick to numeric values.
Ei
Andreas Albarello wrote:
> Ei Fujioka wrote:
>> I'm having difficulty in trying to filter features in a shapefile by
>> dates.
>>
>> I looked into this mailing list and have found a post saying
>> "MapServer doesn't support date types in shapefiles."
>> This post is a very old one, dated in July 2000.
>>
>> So I'm wondering if the latest Mapserver supports this. And if so,
>> what is the date format for class/filter expression?
>> I use Mapserver 4.2.
>
> Ei,
>
> yes, this should be possible with more recent MapServer releases. I
> don't know whether it used to work back in the day of MapServer 4.2. You
> should really upgrade to 4.6 at least.
>
>> Can't I use a string value like '2003-03-01' for date comparison?
>> I tried the following expression but failed.
>> EXPRESSION ([DATE_S] > '2003-01-01')
>>
>> Is there any smarter way to filter on dates?
>
> Yes, you need to explicitly tell MapServer that you want the field and
> your value to be treated as dates rather than strings. You do this by
> surrounding them with backticks (ASCII #96), for instance:
>
> EXPRESSION (`[DATE_S]` > `2003-01-01`)
>
> Best regards,
--
======================
Ei Fujioka
Research Associate
Duke University
(919) 613-8021
efujioka at duke.edu
======================
More information about the MapServer-users
mailing list