dennis
dennis

Reputation: 119

Python Date Issue

Good morning, everyone, are there any Python functions to get Year, Month, Day, Weekday, Hour information from the following time?

1/21/2015 01:30:22 AM

Thank you very much. Dennis

Upvotes: 0

Views: 37

Answers (1)

Sebastien D
Sebastien D

Reputation: 4482

According to the strftime documentation:

from datetime import datetime
mydate = '1/21/2015 01:30:22 AM'
print datetime.strptime(mydate, '%m/%d/%Y %I:%M:%S %p')

Upvotes: 1

Related Questions