Re: data import: 12-hour time w/o AM/PM - Mailing list pgsql-sql

From Oliveiros d'Azevedo Cristina
Subject Re: data import: 12-hour time w/o AM/PM
Date
Msg-id 74DB3341AB704E989C87CAAD89D2526F@marktestcr.marktest.pt
Whole thread Raw
In response to data import: 12-hour time w/o AM/PM  (Tarlika Elisabeth Schmitz <postgresql3@numerixtechnology.de>)
Responses Re: data import: 12-hour time w/o AM/PM  ("Tarlika Elisabeth Schmitz" <postgresql3@numerixtechnology.de>)
List pgsql-sql
Howdy, Tarlika.

If the data doesn't bring the AM/PM how are you supposed to distinguish 
between,say, 10pm and 10am ? Does it always start at 10:30am? So 10am never 
arises?

Best,
Oliveiros

----- Original Message ----- 
From: "Tarlika Elisabeth Schmitz" <postgresql3@numerixtechnology.de>
To: <pgsql-sql@postgresql.org>
Sent: Tuesday, February 08, 2011 6:14 PM
Subject: [SQL] data import: 12-hour time w/o AM/PM


I am importing data in CSV format. My technique is to COPY the data
into interim tables (starting with a "z") where I analyze them, clean
up inconsistencies; eventually I will populate the "proper" tables with
these data. (In the example below: COPY CSV into zevent, from there
populate event.)

The time field of the event data is givng me a headache: it's in 12h
format but without the AM/PM qualifier!

CREATE TABLE zevent
( id integer, previous integer, "next" integer, location_id integer NOT NULL, datum date NOT NULL, otime character
varying(5)NOT NULL
 
)

CREATE TABLE event
( id integer NOT NULL, location_fk integer NOT NULL, otime timestamp without time zone NOT NULL, next_fk integer,
previous_fkinteger, CONSTRAINT event_pkey PRIMARY KEY (id), CONSTRAINT next_event_fk FOREIGN KEY (next_fk)
REFERENCESevent (id) MATCH SIMPLE     ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT previous_event_fk FOREIGN KEY
(previous_fk)    REFERENCES event (id) MATCH SIMPLE     ON UPDATE NO ACTION ON DELETE NO ACTION
 
)


From the date and time I want to create a timestamp.
I know that
- the events take place during the day, say between 10:30 and 22:30
- it's always a set of events at one location spaced about 30min apart
- the imported data are chained (have a link to previous/next event)


Have you got any idea how I could tackle this problem



-- 

Best Regards,
Tarlika Elisabeth Schmitz

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql 



pgsql-sql by date:

Previous
From: Tarlika Elisabeth Schmitz
Date:
Subject: data import: 12-hour time w/o AM/PM
Next
From: Leif Biberg Kristensen
Date:
Subject: Re: data import: 12-hour time w/o AM/PM