title: Changing Timezone of DateTime to satisfy API contract
body: <p>I have a swagger generated client. Surprisingly the API expects all date parameters to be exactly in UTC+02:00 and cant handle just the time zone information provided. Now whatever I do, I can't get the timezone bit correct (+02:00). The following code always prints +01:00 regardless of the time zone I provide.</p>
  <pre class="lang-cs prettyprint-override"><code>TimeZoneInfo.ConvertTime(new DateTime(2020, 1, 8, 0, 0, 0, DateTimeKind.Utc), TimeZoneInfo.FindSystemTimeZoneById(&quot;Asia/Magadan&quot;)).ToString(&quot;zzz&quot;)
  </code></pre>
  <p>As I mentioned earlier this is a generated client over which I have no control. So I can not mess with the json serializer.
  API:</p>
  <pre><code>List&lt;GLJournalEntry&gt; Create (PostGLJournalEntriesDTO body, string idempotencyKey = null);
  </code></pre>
  <p>DTO:</p>
  <pre class="lang-cs prettyprint-override"><code>        public PostGLJournalEntriesDTO(List&lt;GLAccountAmount&gt; credits = default(List&lt;GLAccountAmount&gt;), List&lt;GLAccountAmount&gt; debits = default(List&lt;GLAccountAmount&gt;), string branchId = default(string), DateTime? date = default(DateTime?), string notes = default(string), string transactionId = default(string))
          {
              this.Credits = credits;
              this.Debits = debits;
              this.BranchId = branchId;
              this.Date = date;
              this.Notes = notes;
              this.TransactionId = transactionId;
          }
  </code></pre>
  <p>JSON-Model:</p>
  <pre><code>&quot;PostGLJournalEntriesDTO&quot;:{
           &quot;type&quot;:&quot;object&quot;,
           &quot;properties&quot;:{
                &quot;date&quot;:{
                 &quot;type&quot;:&quot;string&quot;,
                 &quot;format&quot;:&quot;date-time&quot;,
                 &quot;example&quot;:&quot;2016-09-06T13:37:50+03:00&quot;,
                 &quot;description&quot;:&quot;Date/time stamp when the entries were recorded (Booking Date)&quot;
              
  },
              &quot;branchId&quot;:{
                 &quot;type&quot;:&quot;string&quot;,
                 &quot;description&quot;:&quot;The id of the assigned branch for the journal entries&quot;
              
  },
              &quot;notes&quot;:{
                 &quot;type&quot;:&quot;string&quot;,
                 &quot;description&quot;:&quot;Optional notes entered by the user when they performed the journal entry log&quot;
              
  },
              &quot;credits&quot;:{               &quot;type&quot;:&quot;array&quot;,
                 &quot;description&quot;:&quot;The list of GL Accounts to be credited with the corresponding amounts&quot;,
                 &quot;items&quot;:{
                    &quot;$ref&quot;:&quot;#/definitions/GLAccountAmount&quot;
                 
  }
              
  },
              &quot;debits&quot;:{               &quot;type&quot;:&quot;array&quot;,
                 &quot;description&quot;:&quot;The list of GL Accounts to be debited with the corresponding amounts&quot;,
                 &quot;items&quot;:{
                    &quot;$ref&quot;:&quot;#/definitions/GLAccountAmount&quot;
                 
  }
              
  },
              &quot;transactionId&quot;:{
                 &quot;type&quot;:&quot;string&quot;,
                 &quot;description&quot;:&quot;An id for the transaction. Not unique. Will be auto generated if not provided.&quot;
              
  }
           
  },
           &quot;description&quot;:&quot;The representation of a payload for creating GL Journal Entries&quot;
        
  }
  </code></pre>
  <p>An id for the transaction. Not unique. Will be auto generated if not provided.
  }</p>
  <p>When I invoke the API I get an exception:</p>
  <blockquote>
  <p>{&quot;errors&quot;:[{&quot;errorCode&quot;:4,&quot;errorSource&quot;:&quot;Invalid date offset for value 2020-01-08T23:00:00+01:00 of date org offset is +02:00&quot;,&quot;errorReason&quot;:&quot;INVALID_PARAMETERS&quot;}]}</p>
  </blockquote>
  <p>If I curl the api using 2020-01-08T23:00:00+02:00, everything works.</p>
  <p>It is pretty clear that this is a bug on their end (as even the example states a date with +03:00). However I cant wait for them fixing this for me and I need to find a workaround (at least an intermediate one). The generated client uses RestSharp to serialize out the json (<code>Newtonsoft.Json.JsonConvert</code>).</p>