<p>I used a new Date() object to fill a field in a MySQL DB, but the actual value stored in that field is in my local timezone.</p>

<p>How can I configure MySQL to store it in the UTC/GMT timezone?</p>

<p>I think, configuring the connection string will help but I don't know how. There are many properties in the connection string like useTimezone, serverTimzone, useGmtMillisForDatetimes, useLegacyDatetimeCode, ...</p>

Well, if we're talking about using
```
PreparedStatement
```
s, there's a
form of setDate
where you can pass in a Calendar set to a particular time zone.
For instance, if you have a PreparedStatement named stmt, a Date named date, and assuming the date is the second parameter:
```
```
stmt.setDate(2, date, Calendar.getInstance(TimeZone.getTimeZone("GMT")));
```
```
The best part is, even if GMT is an invalid time zone name, it still returns the GMT time zone because of the default behavior of getTimeZone.