To change format, the strftime method has a number of options available.
Its basic format is
strftime(format)
where format is the format string to be used, which may be specified with the following:
- %A - Full day of the week (Sunday, Monday, etc.)
- %a - Abbreviated day of the week (Sun, Mon, etc.)
- %B - Full month (January, February, etc.)
- %b - Abbreviated month (Jan, Feb, etc.)
- %c - Current Date and Time (system clock format)
- %d - Day of the month (01-31)
- %H - Time of day in 24-hour format (00-23)
- %I - Time of day in 12-hour format (01-12)
- %j - Day of the year (001-366)
- %M - Minutes (00-59)
- %m Numerical month of the year (01-12)
- %p - Displays AM or PM after the time
- %S - The number of seconds (00-60, 60 being a "leap second")
- %U - Week of the year, the first week starting with the first Sunday (00-53)
- %W - Week of the year, the first week starting with the first Monday (00-53)
- %w - Day of the week (0-6, 0 denoting Sunday)
- %X - Displays the Time
- %x - Displays the Date
- %Y - Displays the Year as a 4-digit number (2009)
- %y - Displays the Year as a 2-digit number (00-99)
- %Z - Displays the default (system) Time Zone
- %% - Displays a % character
So, as an example, to display the full date, including day, month and year, strftime would be set to:
strftime = ("%A, %d %B, %Y")
The result would be
Tuesday, 20 May, 2009
And that's it!