Scala Unix Timestamp to Date
datetime, scala
Solution
Try to multiply the timestamp by 1000. I do not know about nscala-time, but other date/time libraries (Joda?) use milliseconds, while (usually) unix epoch is returned in seconds
Problem
I'm trying to get a formatted date object from a unix timestamp using nscala-time in scala. The timestamp comes through Thrift from Node.js which does return a valid timestamp. I've tried multiple ways of trying to convert the timestamp to a `LocalDateTime` or `DateTime`, anything that doesn't return a year of 1970. `scala println(event.uid.toDateTime); ` and I get: ` 1970-01-16T11:59:30.603-07:00 ` With a timestamp of `1364370603`. There's little documentation on the time/data libraries for scala. I'm assuming I'm not using the library correctly, any thoughts?