convert date time
D'Arcy J.M. Cain
darcy at druid.net
Fri Aug 21 21:42:27 CEST 2009
On Fri, 21 Aug 2009 14:43:55 -0400
Ronn Ross <ronn.ross at gmail.com> wrote:
> On Fri, Aug 21, 2009 at 2:26 PM, D'Arcy J.M. Cain <darcy at druid.net> wrote:
> > You don't say what database you are using but you may find it simpler
> > to do the conversion in your SELECT statement. For example, see
> > http://www.postgresql.org/docs/8.3/static/functions-formatting.html for
> > PostgreSQL formatting functions.
> I apologize I should have made it clear that this date is stored in the db
> as a string/varchar. The reason it is stored that way is before it's being
> read in from a text file where it is formatted that way.
You can still save it as a timestamp:
SELECT '8/2/2009 8:36:16 AM (UTC)'::timestamp(0);
Your input format is read into PostgreSQL time types directly. Same
may be true of other databases.
D'Arcy J.M. Cain <darcy at druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list