The Python Oracle

Pythonic way to combine datetime.date and datetime.time objects

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Sunrise at the Stream

--

Chapters
00:00 Pythonic Way To Combine Datetime.Date And Datetime.Time Objects
00:23 Accepted Answer Score 479
00:35 Thank you

--

Full question
https://stackoverflow.com/questions/8474...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#datetime #python

#avk47



ACCEPTED ANSWER

Score 479


It's in the python docs.

import datetime
datetime.datetime.combine(datetime.date(2011, 1, 1), 
                          datetime.time(10, 23))

returns

datetime.datetime(2011, 1, 1, 10, 23)