This may seem like a trivial question, but I took a look at all the available datatypes for dates available in sql and I saw some thing that I needed clarification on. I searched several posts for possible answers, but nothing remotely talked about it.
So my question is:
What makes DATETIME and DATETIME() different?
Should they be treated the same way as you treat variables and methods respective in Java?
The difference is the precision. In MySQL 5.6, for example, DATETIME only stores whole seconds. Fractions are only supported if you use DATETIME(6).
If you access columns with DATETIME or DATETIME(6) types through JPA, most likely you would be mapping them to Date objects and in my experience you can treat them the same way (except that you won't get fractions of seconds with DATETIME).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With