EpochTimeToLocalDate UDF w/Millisecond Support
I needed to convert some Epoch/Unix timestamps (from Ehcache) to date objects. DateAdd() kept throwing an error because it only accepts an integer and the millescond accuracy made the number too big.
“Cannot convert the value 1.426637416706E12 to an integer because it cannot fit inside an integer.”
I was using the EpochTimeToLocalDate UDF to convert timestamps, but it didn't like values with millisecond accuracy. This update provides support for long integers by checking the value to determine if it needs to be divided by 1,000 to have the milliseconds removed.
https://gist.github.com/JamoCA/15e3c3ba0cc855131ca7
NOTE: I encountered issues with "eternal" times with very large integers and had to use the following Java syntax.
theNumber = 1426637416706; theDate = createObject( "java", "java.util.Date" ).init(javacast("long",theNumber));















