Reputation: 4870
I am inserting Date Object from Java to Mongodb, mongo ISODate(...) stores Date with Time, my requirement is to Store both in different field.
is this possible ?
note : don't want solution that stores milliseconds instead of date. want to store only date like "2013-06-19" and time like "00:00:00"
if i use String format for this than hard to perform date operation.
Upvotes: 0
Views: 1300
Reputation: 1454
You can convert the Date object to unix timestamp as timestamp
, then store timestamp / 86400
to a field and timestamp % 86400
to another field.
Upvotes: 2