The field value passed to the formatDate operator needs to be in milliseconds and should have type "long".
There could be below possibilities that can lead to this error
1. The field that you are trying to pass to a "formatdate" is in milliseconds but it is not of "Long" datatype and hence as a part of the parsing it results in this error. The solution is to convert those milliseconds into "Long", by using "toLong" as shown below
| formatDate(toLong(<field>), <date_format>) as <new_field>
2. The field that you are trying to pass to a "formatdate" is a timestamp in non milliseconds format
For example: You are doing below, where my_time has value "11/01/2019 12:52:27.881"
| formatDate(my_time, "MM/dd/yyyy HH:mm:ss.SSS") as my_time1
This will results in "Multiple definitions found for function formatDate(String, String)."
To solve this, we need to perform below
| parseDate(my_time, "MM/dd/yyyy HH:mm:ss.SSS") as my_time_milliseconds //convert date into milliseconds
| formatDate(my_time_milliseconds, "MM/dd/yyyy HH:mm:ss.SSS") as my_time1 //apply formatDate
For more detailed information see here
Comments
0 comments
Please sign in to leave a comment.