Remove Time Zone Offset from DateTimeOffset?
<p>This code:</p>

<pre><code>DateTimeOffset testDateAndTime =
    new DateTimeOffset(2008, 5, 1, 8, 6, 32, new TimeSpan(1, 0, 0));

//CLEAN TIME AND DATE 
testDateAndTime = testDateAndTime.DateTime.Date; 

var datesTableEntry = db.DatesTable.First(dt =&gt; dt.Id == someTestId);
datesTableEntry.test= testDateAndTime;

db.SaveChangesAsync(); 
</code></pre>

<p>...produces this result in my database: <code>2008-05-01 00:00:00.0000000 -04:00</code></p>

<p>How should I revise my code so that it changes the time zone offset from <code>-4:00</code> to <code>+00:00</code> in <code>testDateAndTime</code>?</p>

<p>I have also tried:</p>

<pre><code>public Task&lt;DateTimeOffset&gt; SetTimeZoneOffsetToZero(DateTimeOffset dateTimeOffSetObj)
{
    TimeSpan zeroOffsetTimeSpan = new TimeSpan(0, 0, 0, 0, 0);
    return dateTimeOffSetObj.ToOffset(zeroOffsetTimeSpan);
}
</code></pre>

<p>...but that code doesn't do anything.</p>

<p>My end goal is just to have a date without a time or a time zone offset. I do <em>not</em> want to convert the time to another time zone. (That is, I don't want to subtract 4 hours from the <code>00:00:00.0000000</code> time and remove set time offset to <code>+00:00</code>. I <em>just</em> want to set the offset to <code>+00:00</code>.)</p>

<p>Here is another approach that I came across elsewhere:</p>

<pre><code>DateTimeOffset testDateAndTime =
    new DateTimeOffset(2008, 5, 1, 8, 6, 32, new TimeSpan(1, 0, 0));

testDateAndTime = testDateAndTime.DateTime.Date; //Zero out time portion

testDateAndTime = DateTime.SpecifyKind(
    testDateAndTime.Date, DateTimeKind.Utc); //"Zero out" offset portion
</code></pre>

<p>I was sure that <code>SpecifyKind</code> would <em>convert</em> my <code>DateTimeOffset</code>. That is, change <em>both</em> the time <em>and</em> the time zone offset. But, my test indicates that this code <em>just</em> changes the time zone offset, which is what I want. Is there a problem with doing it this way?</p>