Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python year month from date

import datetime
date = '2021-05-21 11:22:03'
datem = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
print(datem.day)        # 25
print(datem.month)      # 5
print(datem.year)       # 2021
print(datem.hour)       # 11
print(datem.minute)     # 22
print(datem.second)     # 3
Comment

how to get the year in python

from datetime import datetime
Current_Year = datetime.now().year
print(Current_Year)
Comment

how to get the year and month in python

import calander
ear = int(input("Input the year:- "))
Month = int(input("Input the month:- "))
print(calendar.month(y, m))
Comment

PREVIOUS NEXT
Code Example
Python :: how to find avrage python 
Python :: def factorial python 
Python :: python change audio output device 
Python :: executing curl commands in python 
Python :: how to run flask in port 80 
Python :: convert pandas group to dict 
Python :: pandas dataframe map 
Python :: python extract email attachment 
Python :: print example 
Python :: how to add createsuper user in django 
Python :: bar plot 
Python :: basic flask app python 
Python :: convert str to datetime 
Python :: remove string from list in python 
Python :: pass arguments with apply 
Python :: matlab filter in python 
Python :: Python Tkinter Frame Widget 
Python :: generate random list and find max in list python 
Python :: new line print python 
Python :: how to remove a letter from a string python 
Python :: jupyterlab interactive plot 
Python :: run python command 
Python :: if condition in print statement python 
Python :: python temporary file 
Python :: Neuraal Netwerk python text 
Python :: python find center of polygon function 
Python :: django forms date picker 
Python :: ranking 
Python :: find array length in python 
Python :: pandas access multiindex column 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =