Hi,
I'm trying to convert a string into a date. The data comes is as a string but is a long number. I would think the code below would work?
output (meta is defined as a date type) = long2date(str2long($in.0.time));
I've verified that the str2long is keeping the same numbers: 1457895600
But...that number, which should represent March 15th, 2016 15:25:51 returns 1970-01-17 19:58 in the dubug window.
Is there a multiplier or something that I'm missing specific to the clover conversion?
Putting 1457895600 into this website returns the correct date....http://www.epochconverter.com/ ....so not sure where I'm going wrong with applying the long2date function.
thanks for any help!
I'm trying to convert a string into a date. The data comes is as a string but is a long number. I would think the code below would work?
output (meta is defined as a date type) = long2date(str2long($in.0.time));
I've verified that the str2long is keeping the same numbers: 1457895600
But...that number, which should represent March 15th, 2016 15:25:51 returns 1970-01-17 19:58 in the dubug window.
Is there a multiplier or something that I'm missing specific to the clover conversion?
Putting 1457895600 into this website returns the correct date....http://www.epochconverter.com/ ....so not sure where I'm going wrong with applying the long2date function.
thanks for any help!
-
I figured it out....was missing a 1000 multiplier to the long date that was being provided to me. Or you can add that as the solution and post I guess in case someone runs into the same issue....
using this code
output = long2date(str2long($in.0.time)* 1000);
instead of this code
output = long2date(str2long($in.0.time));
fixed the issue and returned the correct date
Please sign in to leave a comment.
Comments 1