Creating a timedelta counter...

W

Wil Schultz

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...

____________________________________________________
# dunno about this
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."
 
A

Adonis

Wil Schultz said:
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...

____________________________________________________
# dunno about this
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/lib/module-datetime.html

Adonis
 
W

Wil Schultz

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."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top