[tip] Invalid dates in mdb-export for postgres

Nirgal Vourgère <[email protected]> Mon, 7 Feb 2011 22:36:49 +0000
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
Hi again

I've been annoyed for a long time with some dates being not supported by postgresql, or so I though. I'm talking about dates before 1000 AD. I though postgres refused them. But there is a work around: You simply have to have a 4 digit year. For example 201-01-01T00:00:00 will fail, but 0201-01-01T00:00:00 is ok. Unfortunatly, I was not able to find a strftime format for this.
So now, I'm using:

mdb-export -D "{postgresdate}%Y-%m-%d %H:%M:%S" "$MDB" "$table" | sed -re 's/\{postgresdate\}([0-9]{2})-/00\1-/g' | sed -re 's/\{postgresdate\}([0-9]{3})-/0\1-/g' | sed -re 's/\{postgresdate\}//g

Cheers

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb