Velocity Reviews > Creating a timedelta counter...

Creating a timedelta counter...

Wil Schultz
Guest
Posts: n/a

 07-20-2004
Hey all,
Sorry, I am trying my best to learn python and seem to be able to grab
somethings while others seem to escape me...

I am trying to write a timedelta meter, i.e. "it has been U years, V
months, W day's, X hours, Y minutes, Z seconds since SomePoint"

Here's what I have so far, I can print the current time/date but am
having issues figuring out how to timedelat it...

__________________________________________________ __
from datetime import datetime, timedelta

# This works, will print date/time

from time import gmtime, strftime
strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())

# sometime
myYear = "2004"
myMonth = "7"
myDay = "8"
myHour = "6"
myMinute = "21"
mySecond = "13"
-----------------------------------------------------

--
Wil
my 2¢

"When everything seems to be going well, you have obviously overlooked
something."

Guest
Posts: n/a

 07-20-2004

"Wil Schultz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hey all,
> Sorry, I am trying my best to learn python and seem to be able to grab
> somethings while others seem to escape me...
>
> I am trying to write a timedelta meter, i.e. "it has been U years, V
> months, W day's, X hours, Y minutes, Z seconds since SomePoint"
>
> Here's what I have so far, I can print the current time/date but am
> having issues figuring out how to timedelat it...
>
> __________________________________________________ __
> from datetime import datetime, timedelta
>
> # This works, will print date/time
>
> from time import gmtime, strftime
> strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
>
>
> # sometime
> myYear = "2004"
> myMonth = "7"
> myDay = "8"
> myHour = "6"
> myMinute = "21"
> mySecond = "13"
> -----------------------------------------------------
>
> --
> Wil
> my 2¢
>
> "When everything seems to be going well, you have obviously overlooked
> something."

Check out the datemtime module, in particular the timedelta class.
Hope this helps.

http://www.python.org/doc/current/li...-datetime.html

Wil Schultz
Guest
Posts: n/a

 07-23-2004
Thanks, after much pounding I got it worked out... somewhat anyway!

Wil
my 2¢

"When everything seems to be going well, you have obviously overlooked
something."

> "Wil Schultz" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>Hey all,
>>Sorry, I am trying my best to learn python and seem to be able to grab
>>somethings while others seem to escape me...
>>
>>I am trying to write a timedelta meter, i.e. "it has been U years, V
>>months, W day's, X hours, Y minutes, Z seconds since SomePoint"
>>
>>Here's what I have so far, I can print the current time/date but am
>>having issues figuring out how to timedelat it...
>>
>>________________________________________________ ____
>>from datetime import datetime, timedelta
>>
>># This works, will print date/time
>>
>>from time import gmtime, strftime
>>strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
>>
>>
>># sometime
>>myYear = "2004"
>>myMonth = "7"
>>myDay = "8"
>>myHour = "6"
>>myMinute = "21"
>>mySecond = "13"
>>-----------------------------------------------------
>>
>>--
>>Wil
>>my 2¢
>>
>>"When everything seems to be going well, you have obviously overlooked
>>something."

>
>
> Check out the datemtime module, in particular the timedelta class.
> Hope this helps.
>
> http://www.python.org/doc/current/li...-datetime.html
>
>
>

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Florian Lindner Python 1 06-22-2005 06:24 PM josh@yucs.org Python 0 02-07-2005 04:24 PM josh Python 0 01-20-2005 03:46 PM Christos TZOTZIOY Georgiou Python 3 09-13-2003 10:44 AM Tim Peters Python 0 09-09-2003 12:57 AM