Skip to content

bpo-40643: Update documentations of strftime function for date, time and datetime. #22477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3500,8 +3500,13 @@ static PyMethodDef date_methods[] = {
{"ctime", (PyCFunction)date_ctime, METH_NOARGS,
PyDoc_STR("Return ctime() style string.")},

{"strftime", (PyCFunction)(void(*)(void))date_strftime, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("format -> strftime() style string.")},
{"strftime", (PyCFunction)(void(*)(void))date_strftime, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("strftime(format) -> style\n"
"\n"
"Return a string representing the date, controlled by an "
"explicit format string.\n"
"Format codes referring to hours, minutes or seconds will see "
"0 values.")},

{"__format__", (PyCFunction)date_format, METH_VARARGS,
PyDoc_STR("Formats self with strftime.")},
Expand Down Expand Up @@ -4666,7 +4671,10 @@ static PyMethodDef time_methods[] = {
"timespec specifies what components of the time to include.\n")},

{"strftime", (PyCFunction)(void(*)(void))time_strftime, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("format -> strftime() style string.")},
PyDoc_STR("strftime(format) -> style\n"
"\n"
"Return a string representing the date, controlled by an "
"explicit format string.")},

{"__format__", (PyCFunction)date_format, METH_VARARGS,
PyDoc_STR("Formats self with strftime.")},
Expand Down Expand Up @@ -6356,6 +6364,12 @@ static PyMethodDef datetime_methods[] = {
{"ctime", (PyCFunction)datetime_ctime, METH_NOARGS,
PyDoc_STR("Return ctime() style string.")},

{"strftime", (PyCFunction)(void(*)(void))date_strftime, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("strftime(format) -> style\n"
"\n"
"Return a string representing the date, controlled by an "
"explicit format string.")},

{"timetuple", (PyCFunction)datetime_timetuple, METH_NOARGS,
PyDoc_STR("Return time tuple, compatible with time.localtime().")},

Expand Down