convert date time

Ronn Ross ronn.ross at gmail.com
Fri Aug 21 20:43:55 CEST 2009


On Fri, Aug 21, 2009 at 2:26 PM, D'Arcy J.M. Cain <darcy at druid.net> wrote:

> 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.
>
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090821/ce02e2d4/attachment.html>


More information about the Python-list mailing list