turicreate.SArray.str_to_datetime

SArray.str_to_datetime(format='%Y-%m-%dT%H:%M:%S%ZP')

Create a new SArray with all the values cast to datetime. The string format is specified by the ‘format’ parameter.

Parameters:
format : str

The string format of the input SArray. Default format is “%Y-%m-%dT%H:%M:%S%ZP”. If format is “ISO”, the the format is “%Y%m%dT%H%M%S%F%q”

Returns
——-
out : SArray[datetime.datetime]

The SArray converted to the type ‘datetime’.

See also

datetime_to_str

References

[1] boost date time to string conversion guide (http://www.boost.org/doc/libs/1_48_0/doc/html/date_time/date_time_io.html)

Examples

>>> sa = turicreate.SArray(["20-Oct-2011 09:30:10 GMT-05:30"])
>>> sa.str_to_datetime("%d-%b-%Y %H:%M:%S %ZP")
dtype: datetime
Rows: 1
datetime.datetime(2011, 10, 20, 9, 30, 10, tzinfo=GMT(-5.5))