I have a DataFrame
with a column filled with type string
for date and time. The strings are formatted as "2017-01-01 00:00:00+00:00"
, for instance. Searching online I found that this format is the ISO-standard for date and times. To attempt a conversion from such a string to date and time, I did the following:
using Dates
x = "2017-01-01 00:00:00+00:00"
date_format = DateFormat("yyyy-mm-ddTHH:MM:SS")
x = Date(x, date_format)
My intention was to transform x
from a string to a timestamp. Ideally, I would later broadcast
the Date
function to a column of an entire dataframe, but so far it’s been to no avail. I checked the documentation and found the following:
When creating a
format
you can use any non-code characters as a separator. For example to generate the string “1996-01-15T00:00:00” you could useformat
: “yyyy-mm-ddTHH:MM:SS”. Note that if you need to use a code character as a literal you can use the escape character backslash. The string “1996y01m” can be produced with the format “yyyy\ymm\m”.
I’m fully aware that "yyyy-mm-dd HH:MM:SS+00:00"
is not the same as "yyyy-mm-ddTHH:MM:SS"
, but I tried creating date_format
with "yyyy-mm-dd HH:MM:SS+00:00"
, but it failed.
All and any help will be appreciated.