I have a record that I write out to a CSV file using FileHelpers. I want the DateTime fields of the structure to be written out as the UTC date. I currently have the following formatter:
[FieldConverter(ConverterKind.Date, "yyyy-MM-dd")]
What do I need to do to get it to output the UTC date?
The doc says :
So according to : http://msdn.microsoft.com/en-us/library/az4se3k1.aspx
[FieldConverter(ConverterKind.Date, “u”)]
“u” => “yyyy’-‘MM’-‘dd HH’:’mm’:’ss’Z'”
It doesn’t convert the date to utc, just format it
You still need DateTime.ToUniversalTime to convert it.
Edit
If you have something like :
Then add a temp ShippedDateUTC :