Parsing Date-and-Times from JavaScript to C#
<p>I have some JavaScript code that I'm trying to pass to my web service.  My JavaScript code is supposed to send a date in UTC format. Locally, the time that I generated my code at was at 12:30:43 pm. When I executed my JavaScript code, the following date/time was generated:</p>

<p><em>2012-06-03T20:30:43.000Z</em></p>

<p>That date/time was generated from this code:</p>

<pre><code>var now = new Date();
var utcDate = new Date(
  now.getUTCFullYear(),
  now.getUTCMonth(),
  now.getUTCDate(),
  now.getUTCHours(),
  now.getUTCMinutes(),
  now.getUTCSeconds()
);
</code></pre>

<p>When I pass the date/time from JavaScript back to my web service, it is serialized as shown here:</p>

<p><em>20120603163043</em></p>

<p>That looks correct to me at this point. I then need to take that string and convert it to a date/time in C#. In an attempt to do that, I'm using the following C# code:</p>

<pre><code>DateTime _value = DateTime.MinValue;
DateTime.TryParseExact(value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out _value)
</code></pre>

<p>When that happens, I get the following date/time. 
<em>6/3/2012 12:30:43 PM</em></p>

<p>What am I doing wrong? I was expecting the date/time to be 6/3/2012 4:30:43 PM</p>
