[Tutor] Formating from hhmms to hh:mm:ss

greg whittier greg at thewhittiers.com
Sun Sep 7 18:26:12 CEST 2008


I'm not clear on exactly what you're looking to do, but I think you want the
strftime and strptime methods.  See
http://docs.python.org/lib/datetime-datetime.html

On Sun, Sep 7, 2008 at 11:24 AM, Wayne Watson
<sierra_mtnview at sbcglobal.net>wrote:

>  I've been writing various functions with datetime to change date-time
> formats from one to another. For example, my file names have a time stamp of
> yyyymmdd_hhmmss in their names. When I need to convert, say, time by adding
> seconds to the hhmmss part of the file name, I have a function that converts
> hhmmss to hh:mm:ss,  and another to go the other way. In between, I add
> seconds. Maybe datetime can do this more easily without the use of my
> functions?
> --
>
>            Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>
>              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet                      "If voting made any difference they wouldn't let us do it."
>                         -- Mark Twain
>
>                     Web Page: <www.speckledwithstars.net/>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080907/5082c153/attachment-0001.htm>


More information about the Tutor mailing list