4845 explained code solutions for 96 technologies

pythonHow to get month from date

import datetime
date = '2022-10-20 10:11:12'
month = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S").monthctrl + c

module to manipulate dates/times

date =

example date to extract part from


parses given string with the given format

"%Y-%m-%d %H:%M:%S"

format of the datetime string to parse


returns month part of the date