How to store and compare Date up to sec.

#1

How to store and compare date up to sec? By default it stores the dates like "23 May, 2020 10:25:23:112 AM" means date and timestamp including milisec but  I want to store till sec("23 May, 2020 10:25:23 AM") like MySql and other db. They stores the date up to sec.

#2

ObjectDB stores date values with all their component, as they are in memory.

You can reset date part as you like, before the object is stored in the database. e.g.

https://stackoverflow.com/questions/227007/resetting-the-time-part-of-a-timestamp-in-java

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Hi 

Thank you for the response.I have implemented like as you suggested.Is there any db level configuration?

#4

There is no such setting, the way to go is as described on #2 above.

Note, however, that internally ObjectDB identifies simpler date/time instances, such as in your question, and their storage consumes less space.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login