convert date time

D'Arcy J.M. Cain darcy at druid.net
Fri Aug 21 14:26:38 EDT 2009


On Fri, 21 Aug 2009 14:14:32 -0400
Ronn Ross <ronn.ross at gmail.com> wrote:
> I want to split it into two fields one with the date formatted like this:
> YYYY-MM-DD  2009-08-02
> 
> and the time to be 24 hour or military time. How every you call it. Similar
> to this:
> 15:22:00
> 
> I found it easy to truncate off the (UTC), but having trouble converting the
> date. Can someone point me in the right direction?

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.

-- 
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 mailing list