How to format datetime values

skip at pobox.com skip at pobox.com
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:

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

Skip



More information about the Python-list mailing list