Date&Time to Long

Hi everyone.

With the “UNIX Timestamp to Date&Time” Node I can easily convert my Long Number to a date.

Now I am looking for a way, to convert a date&time to a long number.
Is there any way to it? Because I’ve tried it with the “Column Expression” node, but I receive an error that “The provided value of type ‘LocalDateTime’ cannot be converted to Long”.

I also tried to change the date to a string then from string back to date, I tried to Modify the date and so on.

Nothing works though.

Kind regards

Okay I actually found a solution myself.

The UNIX node uses 1.1.1970 as reference.

So what I did first is to get rid of my timezone and then use the date&Time Diff Node.

image

There I entered the following:

I know that my Granularity is in Millis, it may be different for you.

Because it will calculate the 1970 date - Your Date, it will be negative, that’s why I had to multiply it by -1.
This will change the result to a double, so I used the Column Expression Node to cast it back to a Long Number.

It worked!

5 Likes

Thanks for posting your solution! :+1:

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