[Tutor] Time function

Steve lonetwin@yahoo.com
Sat, 8 Jun 2002 15:58:37 +0530


Hi there, 

On Saturday 08 June 2002 02:44 pm, you wrote:
> Is there a function that returns the time on the computer the script is run
> on? I found some functions on the net but they did not show it in the right
> format. I want it to show the hour and the minutes (just like the clock in
> windows and linux on the taskbar).

You may want to look at the time module (doc. included within the standard 
Python documentation and also at 
http://www.python.org/doc/current/lib/module-time.html )
	Anyways, here is what you needed in an interpreter session:
-----------------------------------------
Python 2.2.1 (#3, May  8 2002, 19:51:42) 
[GCC 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.ctime()
'Sat Jun  8 15:49:39 2002'
>>> time.ctime().split()[3]
'15:53:43'
>>> 
------------------------------------------

Hope that helps

Peace
Steve


-- 
Most people have two reasons for doing anything -- a good reason, and
the real reason.