Linq-to-SQL dbml DateTimeOffset column Auto Generated Value not getting correct timezone

534 views Asked by At

I have a Linq-To-Sql dbml file setup with tables from my SQL database. Each table has it's own InsertDateUTC column which is of type DateTimeOffset. I have them set to Auto Generated Value = true so on insert they will be populated with the currently date.

This all works fine for all my tables/objects except for one. The one in question fills in an auto-generated value, but the timezone offset that gets inserted is always +00:00 unlike the rest of the columns/tables which are -08:00. Edit -08:00 is the desired timezone.

This one (see image below) is setup exactly the same as all the other columns. The only difference (that I can think of) is that it is in a different schema in the database. None of the tables are in the dbo schema, they are all other schemas, all created in the same manner, with the same collation.

This table from SchemaB was added after all the tables from SchemaA were already added if that makes any difference.

What have I not thought of here?

columndef

1

There are 1 answers

1
p.campbell On BEST ANSWER

In SQL Server, what's the default value for this column?

It sounds like +00:00 isn't desirable.

Is it supposed to be SYSDATETIMEOFFSET(), where the server's local datetime (including its UTC offset) is the default? Sounds like that's your case with -08:00.