title: Convert datetime entered by user to UTC
body: <p>The user enters a date and a time in separate textboxes. I then combine the date and time into a datetime. I need to convert this datetime to UTC to save it in the database. I have the user's time zone id saved in the database (they select it when they register). First, I tried the following:</p>
  
  <pre><code>string userTimeZoneID = "sometimezone"; // Retrieved from database
  TimeZoneInfo userTimeZone = TimeZoneInfo.FindSystemTimeZoneById(userTimeZoneID);
  
  DateTime dateOnly = someDate;
  DateTime timeOnly = someTime;
  DateTime combinedDateTime = dateOnly.Add(timeOnly.TimeOfDay);
  DateTime convertedTime = TimeZoneInfo.ConvertTimeToUtc(combinedDateTime, userTimeZone);
  </code></pre>
  
  <p>This resulted in an exception:</p>
  
  <p><code>The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly.  For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local</code></p>
  
  <p>I then tried setting the Kind property like so:</p>
  
  <pre><code>DateTime.SpecifyKind(combinedDateTime, DateTimeKind.Local);
  </code></pre>
  
  <p>This didn't work, so I tried:</p>
  
  <pre><code>DateTime.SpecifyKind(combinedDateTime, DateTimeKind.Unspecified);
  </code></pre>
  
  <p>This didn't work either. Can anyone explain what I need to do? Am I even going about this the correct way? Should I be using DateTimeOffset?</p>