I need to convert a python object datetime.time
to an arrow object.
y = datetime.time()
>>> y
datetime.time(0, 0)
>>> arrow.get(y)
TypeError: Can't parse single argument type of '<type 'datetime.time'>'
You can use the strptime
class method of the arrow.Arrow
class and apply the appropriate formattting:
y = datetime.time()
print(arrow.Arrow.strptime(y.isoformat(), '%H:%M:%S'))
# 1900-01-01T00:00:00+00:00
However, you'll notice the date value is default, so you're probably better off parsing a datetime
object instead of a time
object.