Tried
${longdate:format=yyyy-MM-ddTHH\\:mm:ss.ffffK}
but its not writing in offset into the file using Nlog. Tried
${date:format=yyyy-MM-ddTHH\\:mm:ss.ffffK}
it gives the offset and the time output.
Even tried zzz
instead of K
.
Can we give any other usage for getting the UTC offset in Nlog consoleLayout.Text?
To log DateTimeOffset
in database, I use this:
<parameter name="@logged" layout="${longdate}${date:format= K}" />
Please note, that space following =
really matters! I checked NLog internal log and here is what I found:
Logged value (with space): 2017-04-21 10:05:48.1868000 +02:00
Logged value (without space): 2017-04-21 10:05:48.1868000
Hope it helped.