[gdal-dev] ogr2ogr SQL Date Calculation
Langford, Robert
Robert.Langford at salford.gov.uk
Mon Jul 11 11:11:54 EDT 2011
All,
I am trying to use ogr2ogr as a scheduled command line task to run weekly to convert a .SHP file to a .TAB file whilst filtering the data based on a date field. I would like to only convert records that have a date from the last 30 days.
Therefore If the task ran today (11/07/2011) the below line would return the required data:
ogr2ogr -f "MapInfo File" -sql "select * from DCPOLY where DATE_CREA1>'2011/06/11'" D:\Data\Plan_Apps.tab D:\Data\DCPOLY.shp
Obviously if the task ran tomorrow the date would have to be changed to '2011/06/12'. So I need the field SQL to be something like:
DATE_CREA1> Todays_Date - 30
Does anyone know of a way to automate this using something like; GetDate(), Now(), sysdate, Date /t, etc? Any help would be greatly appreciated.
Many thanks,
Rob
Robert Langford
Systems Developer (GIS)
Corporate Applications Team
Salford City Council
Tel: 0161 793 2492
Email: robert.langford at salford.gov.uk<mailto:robert.langford at salford.gov.uk>
Web: www.salford.gov.uk<http://www.salford.gov.uk/>
Salford Civic Centre,
Chorley Road, Swinton, M27 5DA
DISCLAIMER: The information in this message is confidential and may be legally privileged. It is intended solely for the addressee.
Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful.
As a public body, Salford City Council may be required to disclose this email [or any response to it] under the Freedom of Information Act 2000, unless the information in it is covered by one of the exemptions in the Act.
Please immediately contact the sender if you have received this message in error.
For the full disclaimer please access http://www.salford.gov.uk/e-mail. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110711/be9039bb/attachment.html
More information about the gdal-dev
mailing list