intelmq icon indicating copy to clipboard operation
intelmq copied to clipboard

Generic CSV parser: time conversion and time format

Open MariusUrkis opened this issue 4 years ago • 1 comments

When CSV parser parses the file and event line contains time format like %d-%m-%Y, fuzzy time conversion fails to guess correct time format. Example of the feed is http://benkow.cc/export.php Fuzzy conversion works with such date entries:

DateTime.convert_fuzzy('12-08-2021') '2021-12-08T00:00:00' And correct with days >12 : DateTime.convert_fuzzy('16-08-2021') '2021-08-16T00:00:00'

Probably better option to use from_format:

DateTime.convert_from_format('12-08-2021', '%d-%m-%Y') '2021-08-12T00:00:00+00:00'

MariusUrkis avatar Sep 09 '21 13:09 MariusUrkis

The parameter time_format of the CSV Parser could be extended for this purpose

ghost avatar Sep 09 '21 15:09 ghost