Fork me on GitHub

I don’t think date before 1970 is possible, because we are storing dates in unix epoch time


which starts on 1970


basically, :instant is stored as a long of millisecond since 1970/01/01


you could use other data types, e.g. string, and do your own conversion.

Norman Kabir13:02:41

Thanks, @huahaiy! Is this because LMDB is written in C? I'm trying to wrap my head around the JavaScript origin of DataScript, C of LMDB, and Clojure of Datalevin 😉


@huahaiy (and @nkabir): if lmdb is storing only bytes then it's up to us (the app) to interpret thoese bytes how we want, no? :If we choose to interpret 8 bytes as an instant from 1970 - then yes, we can't refer to older dates. If we choose to store and interpret 8 bytes as a date only (no time) we get a very big range. One example is PostgreSQL's date and time: .

timestamp [ (p) ] with time zone 	8 bytes 	both date and time, with time zone 	4713 BC 	294276 AD 	1 microsecond

date 	4 bytes 	date (no time of day) 	4713 BC 	5874897 AD 	1 day

interval [ fields ] [ (p) ] 	16 bytes 	time interval 	-178000000 years 	178000000 years 	1 microsecond


btw @huahaiy: does data levin offer any support for the new java time api ? I imagine it uses java.util.Date for compatibility reasons. Looking at the API, one might be able to de/serialzie new Java time API's by implementing a custom - to read date from raw bytes stored in a lmdb buffer. and using e.g localdate.from(TemporalAccessor) method . Would this be something usefull ?

Norman Kabir14:02:23

> timestamp [ (p) ] with time zone 8 bytes both date and time, with time zone 4713 BC 294276 AD 1 microsecond @eugen.stan this range is more than sufficient for anything I would need. I am implementing the examples from They are storing birthdays in the #inst field. It would be nice to retain as much fidelity as possible with their examples. If someone can point me to the relevant logic in Datalevin, I can try to create a pull request (assuming @huahaiy supports the idea). Also, I can create a gist for the Datalevin Github with those implementations (and workarounds) to help people understand how to use this library. It is a great piece of software.


I would be happy to help - initially with testing and maybe some review. I also think lmdb and datalevin are great.

Norman Kabir15:02:01

I initially created an issue here. Dennis asked me to post here. It may be easier to track this with the issue but I'll follow whatever convention the community prefers.


I think having only the instant type from 1970 is very limitting.