#Print themnow.isoformat()#'2023-03-30T23:36:52.926931'now.strftime('We are the %d, %b %Y')
Parsing
POSIX/UTC using a local time zone
from datetime import datetimedatetime.fromisoformat("2011-11-04T00:05:23Z")datetime.fromtimestamp(1553236529)#POSIX/UTC localdatetime.utcfromtimestamp(1553236529)#UTC local
Strptime lets you parse arbitrary formats: see here for all the meanings
a = datetime.datetime(100,1,1,11,34,59)b = a + datetime.timedelta(0,3)# days, seconds, then other fields.## or just replace what you want now = now.replace(hour=5, minute=0, second=0, microsecond=0)