[gdal-dev] PostGIS date field output
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Feb 28 13:56:11 PST 2013
On 2/28/2013 4:40 PM, Kralidis,Tom [Ontario] wrote:
> Hi: we are using 1.9.2 via MapServer WFS to serve out PostGIS data in
> GeoJSON, which works very well -- great feature!
>
> I was having issues with GeoJSON output on date fields when hour is <
> 10.
>
> Digging deeper:
>
> The column in question is of PostgreSQL type 'timestamp without time
> zone'. When querying the data in psql, I get:
>
> mydatetime: 2013-02-19 01:03:34
>
> When I do an ogrinfo the same is shown as:
>
> mydatetime (DateTime) = 2013/02/19 1:03:34
>
> The month is zero padded, but not the hour. I would have expected it to
> be consistent one way or the other. Naturally, any format which OGR
> writes to carries this format.
>
> Our downstream UI (in this case) has to implement a workaround, as it
> expects zero padded hour values.
>
> Is this by design in GDAL/OGR? Is there any we can do to output hour
> values zero padded in this case? I'd rather not have the front end have
> to fix this, and using MapServer WFS out of the box leaves us little
> options for custom scripting.
Tom,
Can you cast it to a string in sql so it gets passed through a text?
-Steve W
More information about the gdal-dev
mailing list