Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python Datetime Get year, month, hour, minute, and timestamp

# Python program to demonstrate datetime object
# import datetime class
from datetime import datetime

my_datetime = datetime(1999, 3, 8, 23, 32, 12)

print("year =", my_datetime.year)
print("month =", my_datetime.month)
print("day =", my_datetime.day)
print("hour =", my_datetime.hour)
print("minute =", my_datetime.minute)
print("timestamp =", my_datetime.timestamp())
Comment

Python Print year, month, hour, minute and timestamp

from datetime import datetime

a = datetime(2017, 11, 28, 23, 55, 59, 342380)
print("year =", a.year)
print("month =", a.month)
print("hour =", a.hour)
print("minute =", a.minute)
print("timestamp =", a.timestamp())
Comment

PREVIOUS NEXT
Code Example
Python :: change month name in python 
Python :: Jinja for items in list 
Python :: format date string python 
Python :: cv2 opencv-python imshow while loop 
Python :: delimiter pandas 
Python :: ValueError: cannot convert float NaN to integer 
Python :: python code to demonstrate inheritance 
Python :: PY | websocket - client 
Python :: pthon return value with highest occurences 
Python :: name, *line = input().split() 
Python :: how to use modulo in python 
Python :: tkinter filedialog how to show more than one filetype 
Python :: how to remove a letter from a string python 
Python :: for each loop python 
Python :: Python Tkinter PanedWindow Widget 
Python :: python loop backwards 
Python :: format dictionary python 
Python :: generate n different colors matplotlib 
Python :: python encoding utf 8 
Python :: remove key from dictionary 
Python :: python find center of polygon function 
Python :: eval function in python 
Python :: how to make a bill in python 
Python :: python 3 tkinter treeview example 
Python :: how to read .xlsx file in python 
Python :: to_frame python 
Python :: python for loop increment 
Python :: Display an image over another image at a particular co-ordinates in openCV 
Python :: django form example 
Python :: flask app with spark 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =