views:

527

answers:

1

I'm using Visual Studio 2008. I'm using an .xsd/tableadapters to access a SQL Server 2005 database. One of my tables has a DateTime field. When a record is inserted into the table, the time is automatically converted to the UTC time, which is fine. I just want to know where that takes place. Does SQL Server do the conversion or is .Net doing it? I couldn't find a property in my table column that allows you to set it to UTC. Did I miss something?

I'm using .Net 3.5. Does the System.DateTime datatype automatically use UTC? I tried using the ToUniversalTime method when I insert into my table and the time is the same as when I don't use it.

A: 

It's .NET.

To verify, start a SQL Profiler trace and examine the values sent across the wire.

[BTW, SQL Server 2008 has the datetimeoffset data type for UTC aware date and times.]

Mitch Wheat