LocalDateTime to ZonedDateTime
<p>I have Java 8 Spring web app that will support multiple regions.  I need to make calendar events for a customer location.  So lets say my web and Postgres server is hosted in MST timezone (but I guess it could be anywhere if we go cloud).  But the customer is in EST.  So, following some best practices I read, I thought I would store all date times in UTC format.  All date time fields in the database are declared as TIMESTAMP.</p>

<p>So here is how I take a LocalDateTime and convert to UTC:</p>

<pre><code>ZonedDateTime startZonedDT = ZonedDateTime.ofLocal(dto.getStartDateTime(), ZoneOffset.UTC, null);
//appointment startDateTime is a LocalDateTime
appointment.setStartDateTime( startZonedDT.toLocalDateTime() );
</code></pre>

<p>Now , for example, when a search for a date comes in, I have to convert from the requested date time to UTC, get the results and convert to the user timezone (stored in the db):</p>

<pre><code>ZoneId  userTimeZone = ZoneId.of(timeZone.getID());
ZonedDateTime startZonedDT = ZonedDateTime.ofLocal(appointment.getStartDateTime(), userTimeZone, null);
dto.setStartDateTime( startZonedDT.toLocalDateTime() );
</code></pre>

<p>Now, I am not sure this is the correct approach.  I also wonder if because I am going from LocalDateTime to ZonedDateTime and vice versa, I might be losing any timezone info.</p>

<p>Here is what I am seeing and it doesn't seem correct to me.  When I receive the LocalDateTime from the UI, I get this:</p>

<pre><code>2016-04-04T08:00
</code></pre>

<p>The ZonedDateTime =</p>

<pre><code>dateTime=2016-04-04T08:00
offset="Z"
zone="Z"
</code></pre>

<p>And then when I assign that converted value to my appointment LocalDateTime I store:</p>

<pre><code>2016-04-04T08:00
</code></pre>

<p>I feel like because I am storing in LocalDateTime I am losing the timezone that I converted into ZonedDateTime.</p>

<p>Should I make my entity (appointment) use ZonedDateTime instead of LocalDateTime so that Postgres doesn't loose that information?</p>

<p>---------------- <strong>Edit</strong> ---------------- </p>

<p>After Basils excellent answer, I realized that I have the luxury of not caring of the users timezone - all appointments are against a specific location so I can store all date times as UTC and then convert them to the location timezone when retrieved.  I made the following followup <a href="https://stackoverflow.com/questions/36563191/postgres-utc-to-java-zoneddatetime">question</a></p>