Hi Jeremy,
On 21 May 2012 16:47, Jeremy Traurig wrote:
> Is there a module available for python to convert datetime into an
>
I presume you mean, "convert a datetime *string* into an array of integers"?
array of integers. For example, I have date where the first column is
> a datetime string (i
On Mon, May 21, 2012 at 11:47 AM, Jeremy Traurig
wrote:
> Hello,
>
> Is there a module available for python to convert datetime into an
> array of integers. For example, I have date where the first column is
> a datetime string (i.e. '2010-10-10 01:10:00') and I would like to
> convert that into a
This should do what you want.
import time
timestring = '2010-10-10 01:10:00'
time_format = '%Y-%m-%d %H:%M:%S'
timestruct = time.strptime(timestring, time_format)
print [x for x in timestruct]
For complex date parsing I would recommend checking out the dateutil.parser
http://labix.org/python-dat