Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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())
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #Datetime #Get #timestamp
ADD COMMENT
Topic
Name
2+9 =