Hello everyone,
I have a filed date where my date is in the following format: 2016-03-30T12:37:27.424709000Z and I would like to convert it in millisecond.
Do you how to do ? I didn't find a solution
Thank you for your help and your attention.
S
Hello everyone,
I have a filed date where my date is in the following format: 2016-03-30T12:37:27.424709000Z and I would like to convert it in millisecond.
Do you how to do ? I didn't find a solution
Thank you for your help and your attention.
S
Perhaps you can use the mutate filter's gsub option to replace the last six digits with an empty string, i.e. \d{6}Z$
-> Z
.
Hi Magnus,
Thank you for the info but how i am supposed to use that in order to get the date in milliseconds.
Did you look at the documentation of the mutate filter's gsub option?
Yes, I did !
Actually, I finally found what i was looking for:
ruby {
code => "event['milli'] = 1000*Time.parse(event['[myDate]']).to_f"
}
Oh, you wanted to convert the timestamp to milliseconds since the epoch? Then I misunderstood your question.
no problem !
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.