title: AutoMapper 6.0 Revised Mapping to handle TimeZone conversion
body: <p>I've two functions:
  <strong>1st:</strong></p>
  
  <pre><code>private DateTime LocalTime(DateTime? value)
  {
  TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("TimeZone String ID");
  DateTime dtz = TimeZoneInfo.ConvertTimeFromUtc((DateTime)value, tz);
  return dtz;
  }
  </code></pre>
  
  <p><strong>2nd:</strong></p>
  
  <pre><code>private DateTime UTCTime(DateTime? value)
  {
  TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("TimeZone StringID");
  DateTime dtz = TimeZoneInfo.ConvertTimeToUtc((DateTime)value, tz);
  return dtz;
  }
  </code></pre>
  
  <p>I'm mapping to change DateTime? from user input to UTC like this</p>
  
  <pre><code>CreateMap&lt;DateTime?, DateTime?&gt;().ConvertUsing(dt =&gt; LocalTime(dt));
  </code></pre>
  
  <p>This mapping is working perfectly, the problem is this mapping is done on (Entity,ViewModel)</p>
  
  <p>I need to do similar mapping for (ViewModel,Entity) but this time I need to covert from LocalTime to UTCTime, in other word
  When I have (Entity,Model) then convert UTC to Local
  and
  When I have (Model,Entity) then convert Local to UTC.</p>
  
  <p>Thank you in advance</p>