Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python datetime strptime hour minute second

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

PREVIOUS NEXT
Code Example
Python :: how to join a string by new line out of a list python 
Python :: get text between two strings python 
Python :: python generate secret key 
Python :: python print range 
Python :: resize image array python 
Python :: python print list with newline 
Python :: tkinter start maximized 
Python :: python list ascii 
Python :: selenium proxy python chrome 
Python :: how to get all the files in a directory in python 
Python :: how to access for loop counter of outer loop 
Python :: python fibonacci generator 
Python :: use python3 as default mac 
Python :: python os output to variable 
Python :: python remove empty folders 
Python :: get median of column pandas 
Python :: load diamonds dataset from sns 
Python :: img read 
Python :: number of times a value occurs in dataframne 
Python :: stop a subprocess python 
Python :: classification report value extration 
Python :: python divide every element in a list by a number 
Python :: flipping an image with cv2 
Python :: python Pandas pivot on bin 
Python :: pie chart python pandas 
Python :: check the input format of a date python 
Python :: lisy in python 
Python :: run code with different verions of python 
Python :: colorized progress bar python in console 
Python :: how to add subtitle matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =