Import csv into influxDB. Datetime field parsing error


I’m importing csv file into influxdb by influx cli

But there is some parsing error. My datetime value is a ‘2021-01-01 07:40:00.000’ in csv file.

So I’m using option ‘–header "#datatype dateTime:2006-01-02 12:00:00,long,long’

I got the error message that it’s the ‘parsing time “2021-01-01 00:55:01.000”: month out of range’

What is the date time format for me?

Thank you

Welcome to the community!

I think your dateTime reference string layout is wrong. The influx tools use the Golang time reference layout. Layouts must use the reference time Mon Jan 2 15:04:05 MST 2006 to show the pattern with which to format/parse a given time/string.

I haven’t tested it, but i think your dateTime reference string should be:

--header "#datatype dateTime:2006-01-02 15:04:05.000,long,long"

Also, check that Month and Day are not reversed in your timestamps, is your timestamp YYYY-MM-DD ?

Here some links regarding the Golang time reference layout:

Format a time or date [complete guide] · YourBasic Go
Time Formatting in Golang - GeeksforGeeks

1 Like

Thanks to your reply

I have changed date time format. It’s working now :slight_smile: