title: How can I turn UTC Timezone off for MongoDB
body: <p>I'm using the extension below for MongoDB date fields because of <a href="https://docs.mongodb.com/manual/tutorial/model-time-data/" rel="noreferrer">MongoDB stores times in UTC by default.</a>
  <strike></p>
  <pre><code>    public static class DateTimeExtensions {
      
          public static DateTime AdjustUtcDiffByOffset(this DateTime time) {
              return time.AddHours(DateTimeOffset.Now.Offset.Hours);
          }
      }
  }
  </code></pre>
  </strike>
  All of them cause different problems although I have tried a few ways like attributes or serialization methods in .NET on the application level. I have decided to use this extension in .NET for now but I think that this is not a complete and exact solution too.
  <p><em>Is there any solution for this problem <strong>on the database level</strong> without being dependent on programming language wtih an adjust or something else?</em></p>
  <h3>EDIT</h3>
  <p>I think that I should an explain more after comments below. I already know MongoDB stores times in UTC that linked in this post as you see above. This can be useful but I don't need any UTC time zone difference in my app and I don't want to deal in Presentation Layer for every programming language separately. And also, I don't even want only one extra row or function in the other layers because of move away than base logic or business.</p>
  <p>Let the my architecture undertaking this. I'm pretty lazy, the life is really short and the birds are flying outside :) I don't want the different fields as like as string convertings unnecessarily. I need a datetime type in the db due to I'm doing many time calculation in the app.</p>
  <p>I'm using .NET now and therefore <a href="https://docs.mongodb.com/drivers/csharp" rel="noreferrer">MongoDB .NET driver</a>. I have tried different serialization methods but it cause another problems in the Data Access architecture. <strong>In conclusion, I can use UTC in my another app but I don't want it now and I prefer the local time when I assign to the field</strong>. I have decided to use the encapsulation below for C# especially.</p>
  <pre><code>    private DateTime _startTime;
      public DateTime StartTime {
          get =&gt; _startTime;
          set =&gt; _startTime = new DateTime(value.Ticks, DateTimeKind.Utc);
      }
  </code></pre>