How to format datetime values

skip at skip at
Thu Jun 1 21:37:51 CEST 2006

    Alan> I have a datetime value and want to format it to "June 1, 2006"
    Alan> shape. How can I do that?

Again, Python's introspection capabilities to the rescue:

    % pydoct datetime
    Help on module datetime:

        datetime - Fast implementation of the datetime type.
        class datetime(date)
         |  datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
         |  strftime(...)
         |      format -> strftime() style string.


More information about the Python-list mailing list