|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Post #2
How do I add the date to a program... I mean more like every time i run the program I want to print the date and current time... I have look at some tutorials on this subject and non of them seem to help.. ?? Can anyone help here?
![]() |
|
#2
|
||||
|
||||
|
The simplest way to do this is to use the strftime() function in the time module, which is included as part of the stdlib. For example...
Quote:
You might also be intested in the datetime module (the second link below). http://www.python.org/doc/2.3.4/lib/module-time.html http://www.python.org/doc/2.3.4/lib...e-datetime.html Enjoy! Mark. |
|
#3
|
|||
|
|||
|
t = time.localtime(time.time())
st = time.strftime(" %d-%b-%Y %H:%M:%S", t) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Post #2 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|