Q:

What is this date '1.5146712e+12' and how can I convert it to a proper format in Javascript?

I must use an API that gives me dates of such format:
"date": 1.5146712e+12
"date": 1.5141528e+12
"date": 1.5146712e+12

What on earth is this?! And if it's valid thing how can I convert it to days, months and years?

A:

It definitely looks like a timestamp number, which is a possible standard way of transmitting date/times.
A timestamp is a integer number representing, for instance, milliseconds or other units since a certain fixed date.
Just to clarify, 1.5146712e+12 means 1.5146712 * 10 to the 12th power, so it means 1'514'671'200'000.
This timestamp looks like milliseconds since 1st Jan 1970 00:00:00 000 UTC, more or less, guessed because this is the standard timestamp that is used by the native Javascript Date.
In this context, 1514671200000 should mean

Sat Dec 30 2017 22:00:00 (UTC)

Note that this date/time is (supposedly) UTC.
(you can have a look at http://currentmillis.com)
To use this timestamp in JS, you can simply use new Date(timestamp), which will create a javascript Date object from this timestamp.
Then, if you want a more readable format, you can use .toISOString() to get 2017-12-30T22:00:00.000Z or .toString() with any date format you wish.
Also, for the reverse operation, note that the Date.prototype.getTime() JS function on a Date object will return the underlying timestamp.

