The datetime module in Python works well, providing a function for converting date formats and string formats to each other Strftime/strptime
1. A function converted from a date format to a string format is: Datetime.datetime.strftime ()
2. The function converted from string format to date format is: Datetime.datetime.strptime ()
3, two functions all involve a DateTime format string, listed as follows:
%a of the week, as in Wednesday for Web
%A the full name of the day of the week, as in Wednesday as Wednesday
Abbreviated%B Month; If April is Apr
The full name of the%B month; As in April for April
The time string of the date of the%c standard; (eg: 04/07/10 10:43:39)
After two digits of the%c year
The day ordinal of a month in%d decimal notation
%d Month/day/year
%e the day ordinal of a month in a two-character field, in decimal notation
%F year-month-day
%g two digits of the year, using week-based
%G years, using week-based years
%h Abbreviated month name
%H 24-Hour Hour
%I 12-Hour Hour
%j decimal indicates the day ordinal of the year
%m the month represented by decimal
%M minutes in a 10 o'clock-hour representation
%n New Line character
%p equivalent display of the local AM or PM
%r 12 hours of time
%R display hours and minutes: hh:mm
%s number of seconds in decimal
%t Horizontal Tab
%T display time seconds: hh:mm:ss
%u days of the week, Monday for the first day (values from 0 to 6, Monday to 0)
%u year of the week, the Sunday as the first day (value from 0 to 53)
%V Week of the year, using week-based
%w Decimal Day of the week (value from 0 to 6, Sunday is 0)
%W Week of the year, Monday as the first day (value from 0 to 53)
Date string for%x standard
Time string for%x standard
%y decimal Year without century (values from 0 to 99)
%Y 10 year with century part
%z,%z the time zone name and returns a null character if the time zone name cannot be obtained.
Percent hundred percent semicolon
Python time processing, strftime/strptime in datetime