Closed Ramji-S closed 6 years ago
@Ramji-S Thanks for reporting this. You are right.
The resolution is to pass Date(millisec.longValue() * 1000) instead of Date(millisec.longValue())
If you are interested to contribute you can send a PR, I will merge yours :-)
Sure. Thanks for acknowledging :-)
I have sent a PR containing this fix in https://github.com/Azure/azure-cosmosdb-java/pull/35 Please verify the changes
Thank you @moderakh
Team
When trying to obtain the last modified timestamp of a document ("_ts") using the util method "document.getTimestamp()", I end up getting a date that reads 1970. Upon checking the base code (Resource.java), looks like the value corresponding to field "_ts" is converted to a Double LongValue (ex. 1524473670) and the Date object is created with this longValue. This is where I guess the trouble is, since the util date is getting only the 10 digit value as against 13.
E.g. new Date(1524473670) -> Sun Jan 18 20:57:53 IST 1970 new Date(1524473670000L) (appending 0's) -> Mon Apr 23 14:24:30 IST 2018
Can someone please take a look ?
Regards Ramji