Skip to content
Advertisement

date() expects parameter 2 to be integer, float given

I got the following timestamp long value from database 147836340000 and I want to convert it on data and time. I have tried to use the following:

JavaScript

But unfortunately I am getting the following error:

date() expects parameter 2 to be integer, float given

Please advice on what I need to do.

Advertisement

Answer

It’s probably JS timestamp, so you need to divide it by 1000. But in your example, the date looks off by one extra 0 at the end. It should be 1478363400000 according to JS specs.

Your version:

JavaScript

Try this one (Online Demo):

JavaScript

More details can be found here: Timestamp between Javascript and PHP

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement