Date & time to unix timestamp (new feature request)

Hi everybody,
In this post is explained how to convert a Date&Time cell to traditionally UNIX timestamp using the Date&Time difference node. Nevertheless following the post I obtain a (corrected but) negative timestamp.
As it is a long type integer to convert it to the corrected positive timestamp I have to use 3 more nodes: number to string, string manipulation and string to number.
For this reason I think it would be handy to have a new feature of the Date and Time Difference node where one can set if the difference should be calculated from the Date&Time column or from the fixed Date&Time. In this way it would be possible to obtain directly a corrected positive timestamp.
Best,
Gio

Hi,
you are right, that would be a useful feature. In the meantime, you can use the Column Expression node instead of your chain of three nodes. It can handle long values and you can simply use -column("timestamp_column") as the expression. Make sure to set the correct output type at the top!
Kind regards
Alexander

1 Like

Hi there,

how about multiplying your column with -1 using Math Formula node?

Br,
Ivan

@ipazin I think the problem is that the math formula node only outputs double or int, but not long.

1 Like

@AlexanderFillbrunn I get it know.
Tnx,
Ivan

Thank you Alexander. I didn’t know the Column Expression node as I’m still with KNIME 3.7.1. Will pass to the 4.0 soon.
Best

1 Like

Hi there @gcincilla,

Column Expressions node is available from 3.6 :wink:

https://www.knime.com/whats-new-in-knime-36#column-expressions

Br,
Ivan

Ups… I didn’t realize that. Sorry.
Good to know :wink:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.