[PostgreSQL] Inserting a pre-defined date format[solved-ish]

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

[PostgreSQL] Inserting a pre-defined date format[solved-ish]

Post by Jenk »

Hello,

I have a task to migrate some data from CSV files to a PostgreSQL database, and currently I am having difficulty with the Date field on some of the tables - the format is

Code: Select all

D/M/YYYY HH:MM:SS
within the CSV's and PostgreSQL does not like this.

How do I specify a date format when importing a CSV file?

Thanks in advance.
Last edited by Jenk on Mon Jul 02, 2007 5:33 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Automated import, or PHP-driven?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Automated (by means of "COPY table FROM '/some/path/file.csv' DELIMETERS ',' CSV;")
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Problem evaded.. I obtained the original MDB file, then exported via ODBC to PostgreSQL.
Post Reply