I have many long numbers which look like 1568694302232954486 and 1568703521360049938, and I need to convert each of them into a Java Date object.
How to implement the above requirement in Java 8? I also need transform the nanosecond value into elasticsearch's timestamp and have found the correct way; thanks for all the help!
Just for those who need it, the following code block has passed the test. It's actually part of a logstash configuration file:
ruby {
init => ""
code => "
event.set('time_local',event.get('time_local').to_f*0.000001)
"
}
date {
#15/Aug/2019:14:46:19 +0800 [02/Sep/2019:09:28:33 +0800]
match => [ "time_local" , "yyyy-MM-dd HH:mm:ss,SSS","UNIX_MS"]
timezone => "Asia/Shanghai"
target => "@timestamp"
}