Skip to content

parseTime does not recognize fractions of a second #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hweidner opened this issue Apr 22, 2015 · 3 comments
Closed

parseTime does not recognize fractions of a second #331

hweidner opened this issue Apr 22, 2015 · 3 comments

Comments

@hweidner
Copy link

Beginning with MySQL 5.6.4, a field of type DATETIME or TIMESTAMP can have a resolution up to one microsecond. See http://dev.mysql.com/doc/refman/5.6/en/datetime.html for details.

go-mysq-driver/mysql with parseTime=true does currently not recognize fractions of a second. You need to define a field as DATETIME(0) (or skip the precision) to make MySQL output the time without fractional part.

Can the parser be extended to recognize fractions?

@arnehormann
Copy link
Member

Are you using a recent driver version? This is solved by #249...

@josephbuchma
Copy link

@arnehormann this change is not backward compatible because MySQL rounds time UP.
So when you don't use microsecond resolution and insert something like time.Now() into db, the stored time will be up to 1 second "in future".
Can we add a flag to disable this feature and restore v1.2.x behavior ?

@josephbuchma
Copy link

created issue #713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants