[reportlab-users] Problems Printing Dates & Times

Tim Roberts timr at probo.com
Thu Nov 1 19:23:35 EDT 2007


Rich Shepard wrote:

> I want to print the date and time a report is printed using the python

> datetime() module. It's not working as expected.

>

> At the head of the file I have

> import datetime

>

> Some lines down are:

>

> now = datetime.datetime.now


"now" is a function, not a member.
now = datetime.datetime.now()

A few minutes with the command-line interpreter would probably have
shown that more quickly than this mailing list.

The function returns a datetime object. The string representation is
"2007-11-01 15:21:11.027000". If you want more control over your date
format, you use the "strftime" method to format it to your liking.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list