Golang inserting time.Now into database being shifted to UTC
<p>I am trying to insert a time.Now() field into the database, but what keeps happening is the time is shifted forward to UTC. I understand the idea is to always to that then convert to local time when presenting to the user. Problem is I have inherited this system and it is currently far to ingrained to be easily changed.</p>

<p>Any tips? I saw that you can set the loc in the DSN but it does not explain what to change it to nor its actual effect, so I would appreciate information there.</p>

<p>Edit: Some information, it is MySQL DB,using go-mysql 1.1 and go 1.6.3. The data is being inserted into a DATETIME field.</p>

<p>The data is incorrect at the insert. GORM Debug shows one time and MySQL query logger  shows it shifted forward.</p>

<p>I have found that the issue is that the go-mysql driver automatically shifts times to be UTC, and this can be altered using the loc parameter in the DSN. This however also changes how the time is returned.</p>

<p>To resolve this add loc=Local to your DSN.</p>