473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Creating a timedelta counter...

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."
Jul 18 '05 #1
2 2002

"Wil Schultz" <ne**@rekon.NOSPAM.org> wrote in message
news:10*************@corp.supernews.com...
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/li...-datetime.html

Adonis
Jul 18 '05 #2
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."
Adonis wrote:
"Wil Schultz" <ne**@rekon.NOSPAM.org> wrote in message
news:10*************@corp.supernews.com...
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/li...-datetime.html

Adonis

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Chris | last post by:
Is there a way to make python create a list of Mondays for a given year? For example, mondays =
1
by: Philipp | last post by:
Hello Pythonistas I'm new to Python, I hope you understand my question. I would like to pass a parameter "gap" to a function. gap should be used there to create a timedelta Object. from...
6
by: Carl J. Van Arsdall | last post by:
Basically I used the datetime module and timedelta objects to calculate a difference between two times. Now I'm trying to figure out how I make that time delta a string HH:MM:SS to show elapsed...
2
by: skip | last post by:
Running from Subversion, I see confusing (to me) behavior related to division of datetime.timedelta objects by integers: % python Python 2.6a0 (trunk:57277:57280M, Aug 28 2007, 17:44:49) on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.