serilog-sinks-mssqlserver: TimeStamp ConvertToUtc not working

Hi,

I’m struggling with setting my timestamp column to UTC time. Can you guys see any issue with this code?

private static ColumnOptions GetColumnOptions()
{
    var columnOptions = new ColumnOptions
    {
        Store = new Collection<StandardColumn>(),
        TimeStamp = 
        {
            ConvertToUtc = true,
            ColumnName = "Created"
        },
        AdditionalDataColumns = new Collection<DataColumn>
        {
            new DataColumn
            {
                DataType = Type.GetType("System.DateTime"),
                ColumnName = "Created",
                AllowDBNull = false
            },
            .............
        }
    };
    return columnOptions;
}

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 27 (16 by maintainers)

Most upvoted comments

UTC is not about formatting a timestamp (e.g. how it is written) at all. UTC is a timezone.

For what it’s worth: UTC is not a timezone. GMT is the +0 timezone, UTC is the time without any timezone information. Big difference, data-wise.

The posted code isn’t valid and the OP indicated he pursued a different solution, so closing this one out.