Jörg Brenninkmeyer
Jörg Brenninkmeyer

Reputation: 3344

Does grails / hibernate store Dates with milliseconds in PostgreSQL?

I'm currently using grails with classes storing java.util.Date fields als DATETIME. However I need the precision / milliseconds to be stored as well which I think is not possible with MySQL.

If I switch to PostgreSQL, will it store my Dates with millisecond precision (or is it easy to configure it this way)?

Upvotes: 0

Views: 848

Answers (2)

Tmoney
Tmoney

Reputation: 11

Yes, since MySql 5.6.4 you can use DATETIME(3) for milliseconds, or DATETIME(6) for microseconds

TIME and other types also now support precision.

http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html

Upvotes: 1

Frank Heikens
Frank Heikens

Reputation: 127486

Yes, Hibernate / PostgreSQL can also store milisecond precision, no problem. Use the Hibernate timestamp datatype.

Upvotes: 1

Related Questions