On 27 August 2011 14:14, Peter Eisentraut <pete...@gmx.net> wrote: > On lör, 2011-08-27 at 12:29 +0100, Dean Rasheed wrote: >> So Robert and Merlin both expressed concerns that the existing >> datetime string parsing code is so complicated that adding to it would >> likely just introduce more bugs. >> >> My first thought was 'how hard can it be?' - famous last words :-) > > Maybe you can find an existing Perl or Python module that has already > implemented this. Then the solution might be 5 lines of wrapping this > into a PostgreSQL function. >
Ah now that's an interesting idea. Python's dateutil module seems to come highly recommended, although I don't find this too encouraging: >>> dateutil.parser.parse('today', fuzzy=True) datetime.datetime(2011, 8, 27, 0, 0) >>> dateutil.parser.parse('tomorrow', fuzzy=True) datetime.datetime(2011, 8, 27, 0, 0) >>> dateutil.parser.parse('foobar', fuzzy=True) datetime.datetime(2011, 8, 27, 0, 0) Still, there might be something better out there... Cheers, Dean -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers