Date format in NodeJS is different to PHP


I’m about to recreate my API which I created on IIS/PHP with NodeJS.

I copied the JSON as recommended and it is recognized perfectly in NodeJS. I now found out that there are some differences between NodeJS and PHP.

For example I have a set value for my last data entry.

The exact same properties gives two different formatted results:

{“lastDate”:“2020-06-29 17:38:52.770”}


Is this a bug or does it have to be like that? I could use the formatter, but didn’t have to by now in PHP.

I haven’t used NodeJS yet, but I imagine the timezone settings are set in different places for PHP and NodeJS. Eg if the timezone is set in php.ini, I don’t suppose NodeJS is going to use that value.

That is what it looks like. I think that I will not be the only one who wants to recreate a site in NodeJS and it would be great if the different platforms would behave the same without having to change the Server Action.

Hi @George,

what is your suggestion on this topic? Do you need more information or am I doing something wrong :grinning:?

node returns all dates in UTC, in php it uses the server timezone

@patrick thank you for the confirmation. Will you change this?

No, we aren’t planning on changing this behavior.

what is your recommended way to convert the date to server timezone? I need the microseconds :slight_smile:

We don’t have a formatter that supports microseconds. What is the exact output that you require, perhaps I can help you by making a custom formatter for it.

Hi @patrick, I need just the same output as in PHP (like in my first post). The reason is that I need it for a condition to work correctly.