CsvReader icon indicating copy to clipboard operation
CsvReader copied to clipboard

DateTime serializes to Local Time

Open ukluk opened this issue 9 years ago • 1 comments

The CsvReader serializer is transforming the string "2017-01-09T00:01:47.6145940Z" into local time, But I need to keep the records in UTC.

There is no way to select the DateTimeStyle in the configuration

using (var reader = new StreamReader(lakeStream)) using (var csv = new CsvReader(reader, new CsvConfiguration() { HasHeaderRecord = hasHeaderRecord, Delimiter = delimiter, IgnoreBlankLines = true, IsHeaderCaseSensitive = false,
//Missing DateTimeStyle = DateTimeStyle.AssumeUniversal
})) { rows = csv.GetRecords<T>().ToList(); }

ukluk avatar Jan 10 '17 23:01 ukluk

You could introduce something that parses it as DateTimeOffset - you have a better chance of it coping if you preserve the timezone information.

Happy to accept a pull request

phatcher avatar Feb 16 '17 18:02 phatcher