I need a good OLEDate java implementation, and this one does not seem to be working. Is there any known good opensource implementations (like in apache commons)? If not, where do I read about it, so that I write my own implementation?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The previous implementation is buggy, e.g. wrong dates for 1.0 and -1.25. The implementation below conforms to OLE date described in MSDN, e.g. here: https://msdn.microsoft.com/en-us/library/system.datetime.tooadate(v=vs.110).aspx
Implementation below does conform to the MSDN documentation. It converts a BigDecimal value to Joda LocalDateTime. BigDecimal is better than float and double since it is able to hold a precise value.
This Old New Thing blog entry seems to be a decent treatise on the topic:
The OLE automation date format is a floating point value, counting days since midnight 30 December 1899. Hours and minutes are represented as fractional days.
If you have access to Visual Studio and the MFC COleDateTime source, you can reimplement that in Java.
Try this code: