Datetime module

R

rublind

I am writing a script that acts as an AIM bot [using twisted.IM's base
scripts] and I want to add a logging feature. I got it to log who sends
what to whom, but what I want to add is the date and time that the
message was sent (or recieved by the bot), I tried to look at datetime
on my own, and I couldn't get anything to work.
Anyone know a simple way to get the current date and/or time?

Thanks!
 
B

Binu K S

The time module will do.'Mon Jan 10 11:17:54 2005'

Use strftime if you need to format the time differently.'2005-01-10 11:01:45'

I am writing a script that acts as an AIM bot [using twisted.IM's base
scripts] and I want to add a logging feature. I got it to log who sends
what to whom, but what I want to add is the date and time that the
message was sent (or recieved by the bot), I tried to look at datetime
on my own, and I couldn't get anything to work.
Anyone know a simple way to get the current date and/or time?

Thanks!
 
W

wittempj

take a look at the logging module as well, in the documentation
(paragraph 6.29.2 for release 2.4) you find a basic example
 
M

Mark McEahern

I am writing a script that acts as an AIM bot [using twisted.IM's base
scripts] and I want to add a logging feature. I got it to log who sends
what to whom, but what I want to add is the date and time that the
message was sent (or recieved by the bot), I tried to look at datetime
on my own, and I couldn't get anything to work.
Anyone know a simple way to get the current date and/or time?

You may also want to consider using the logging module.

// m
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top