I am having trouble converting a python datetime64 object into a string. For example:
datetime64
t = numpy.datetime64(\'2012-06-30T20:00:00.000000000-0400\
Building on this answer I would do the following:
import numpy import datetime t = numpy.datetime64('2012-06-30T20:00:00.000000000') datetime.datetime.fromtimestamp(t.item() / 10**9).strftime('%Y.%m.%d')
The division by a billion is to convert from nanoseconds to seconds.