Error in unix ms timestamp conversion

Hello, I have a problem converting date and time from unix ms timestamp to normal timestamp using date and time node as shown below.

if i use the following website to convert the same number, i am getting the correct timestamp.

I assume that it is not a UNIX timestamp rather a JavaScript one. The difference is that the UNIX timestamp is in seconds and the JavaScript one in ms. Meaning you have to divide it by 1000.

Hello @jan , thank you for helping out.

i read the developer guide , and it states that is it in unix milisecond timestamp.

and I have selected to "convert from " ms timestamp by selecting “x”

some update. I tried with a new node it is working now… :grinning:

Glad to hear that you got it working!

Eu estou com o mesmo problema, poderia mostrar a solução?

Hi,

I also have the same issue.
I got a Unix time stamp and it doesn’t want to be converted

Hey @Cizco,

Can you share the output of the node before so we can test it?

Hi @Jon,

Of course!

Here’s the input:

[
  {
    "Id": "18162",
    "Start_time": 1663801200000,
    "End_time": 1663804800000,
    "Room": " The Stadium"
  },
  {
    "Id": "18173",
    "Start_time": 1663797600000,
    "End_time": 1663801200000,
    "Room": " The Stadium"
  },
  {
    "Id": "18178",
    "Start_time": 1663804800000,
    "End_time": 1663808400000,
    "Room": " The Stadium"
  },
  {
    "Id": "18182",
    "Start_time": 1663801200000,
    "End_time": 1663804800000,
    "Room": " The Garden"
  }
]

and there is the output:

[
  {
    "Id": "18162",
    "Start_time": 1663801200000,
    "End_time": 1663804800000,
    "Room": " The Stadium",
    "data": "54693/10/05"
  },
  {
    "Id": "18173",
    "Start_time": 1663797600000,
    "End_time": 1663801200000,
    "Room": " The Stadium",
    "data": "54693/08/24"
  },
  {
    "Id": "18178",
    "Start_time": 1663804800000,
    "End_time": 1663808400000,
    "Room": " The Stadium",
    "data": "54693/11/16"
  },
  {
    "Id": "18182",
    "Start_time": 1663801200000,
    "End_time": 1663804800000,
    "Room": " The Garden",
    "data": "54693/10/05"
  }
]

The “Start_time” from the input is the result put in the “data” column in Output.

It seems that I need it to be converted to RFC 3339 (2022-09-22T20:24:54+00:00) so my calendar can accept the format.

Hey @Cizco,

That was an interesting distraction, I am not sure what is going on but… if you add .toString() to the end of the expression it will work. I have created a bug ticket internally which we will be tracking under N8N-4737

1 Like

Hey @Jon,

Hmm… strange but it works! :smiley:

Much appreciated!
Thanks a lot @Jon!

1 Like

FYI I am running 0.201.0 on my own server and this bug still exists. i added the .toString() and it solved the problem.