# Troubles importing date and time from CSV file

I'm trying to import CSV file with the following format:

20150803 00:00:01.649,1.09675,1.09678


using this code:

Import[filename,
"DateStringFormat" -> {"Year", "Month", "Day", " ", "Hour", ":",
"Minute", ":", "Second", ".", "Millisecond"}]


But this does not import Time part - it only imports the Date:

{{DateObject[{2015, 8, 4}], 1.09675, 1.09682},
{DateObject[{2015, 8, 3}], 1.09675, 1.09678},
...


How can I import all of the information from my file?

Import does not support the time portion of DateStringFormat. (This is a deficiency in the docs if not a bug ) If you know the specific column(s) where your date appears you can map datelist like this:

MapAt[DateList[{#, {"Year", "Month", "Day", " ", "Hour", ":",
"Minute", ":", "Second", ".", "Millisecond"}}] & ,
Import[filename.csv], {All, 1}]


In case you do not know where the strings might occur you can do this:

Map[Quiet@
Check[DateList[{#, {"Year", "Month", "Day", " ", "Hour", ":",
"Minute", ":", "Second", ".", "Millisecond"}}], #] & ,
Import[filename.csv], {-1}]


I would guess this will really kill performance on a large file though.

I found solution at this answer:

And also improved loading speed of my 250Mb CSV file

• 250 Gb, would that mean Giga-Bit or was it a type and would read like GB (Giga-Byte) or are it rather Mega-Bytes really? I would wonder on what machine Mathematica would be able to handle a 250 Gb (30GB ?) CSV file :-) – Albert Retey Sep 17 '15 at 14:31
• Oh, I'm mistaked - my CSV file 250Mb, not 250Gb :) – Slava Bogdanov Sep 19 '15 at 11:23
• OK, that sounds somewhat less demanding :-) – Albert Retey Sep 19 '15 at 13:11