On 04/26/2012 03:09 AM, viral shah wrote: > Hi > > I'm very new to Python programming. > > Please help me to add date and time ! > > Following is the code done by me. > > import datetime > class Module > type(datetime.datetime) > > Now what's the next to do for displaying date and time ? >
Your subject line says you want to SET date and time. But the body of your message says you want to display it. See http://docs.python.org/library/datetime.html, which I got to by searching the docs for datetime. For date, try import datetime today = datetime..date.today() datestr = today.isoformat() print datestr now =datetime.datetime.today() datetimestr = now.isoformat() print datetimestr #2012-04-26T06:56:44.849589 For more flexibility, look up datetime.strftime() -- DaveA -- http://mail.python.org/mailman/listinfo/python-list