Question: I have the timestamp format such as "**2014-01-06T00:39:45.001+0000**" but I don't know exactly what this timestamp format is. So I can't convert it to datetime as I desired.

How can I convert it with Python?

Answer: 
Use [`dateutil.parser.parse`](http://labix.org/python-dateutil):

```
>>> import dateutil.parser
>>> dateutil.parser.parse("2014-01-06T00:39:45.001+0000")
datetime.datetime(2014, 1, 6, 0, 39, 45, 1000, tzinfo=tzutc())

```
You can parse dates and times in arbitrary formats using [`datetime.strptime(date_string, format)`](http://docs.python.org/2/library/datetime.html#datetime-objects), with the grammar for defining `format` presented [here](http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior).

In this case:

```
 format = "%Y-%m-%dT%H:%M:%S.%f%z"

```

**Note:** `%z` is not supported before Python 3.2 for the `.strptime()` method.