Hello, I just started using Knime and a newbie.
I have been analyzing time-series data on other data-processing software like Igor-Pro.
The date/time format on Igor-Pro is elapased time from 1904 1/1 in second. I tried to convert it to Knime date/time format using Date/Time Shift node since I found quite similar post on this forum.
By taking Shift value from the time/date column(elapsed-time) and set Date Reference as 1904 Jan-1, I expected it would work fine, but it did not.
I found the Date/Time Shift mode only accept Interger value, not double precision elapsed time like one I have. By converting the data type into integer, time-precision in millisecond will be lost (although Knime date/time has millisecond time resolution).
How can I do this simple conversion with a simple way?
Thank you very much in advance!
It might be a bit of a workaround, but I would use a Java Snippet (simple) Node with the code below to convert the elapsed time (Epoch) to a date/time string, then use the String to Date/Time node to convert it to KNIME date/time.
Epoch is a double, where the decimal part represents the milliseconds.
long unixdate = (long) Math.round($Epoch$ * 1000); DateFormat formatter = new SimpleDateFormat("d MMM yyyy HH:mm:ss.SSS"); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(unixdate); return formatter.format(calendar.getTime());
Set the return type of the Java Snippet (simple) node to String.
In the String to Date/Time node use exactly the same string from the formatter above in the "date format" configuration field.
This should do the trick.
You can use the Date/Time Shift node, but you need to transform your time:
Instead of using doubles, use the Math Formula node and multiply your number with 1000. By this you will get the milliseconds passed since your start-date. Set the output of the Math Formula to be an Integer and in the Date/Time Shift set the granularity to Seconds.
Hi marco_ghislanzoni & ferry.abt,
Great! Thanks so much for helping me out! :)
das ist der text im inhalt