Convert timestamp from timezone to UTC timestamp?


New Member
I am receiving a timestamp from a third-party API, that looks like: 1540388730994. However, I have been informed that this timestamp is in 'Europe/Amsterdam' timezone.

I need to convert this timestamp to UTC, as we store all our dates in UTC.

How is this possible in JavaScript?

So far I have tried:
const timestamp = 1540388730994

const timestampInUTC =, 'Europe/Amsterdam').utc().valueOf()

console.log(timestamp, timestampInUTC)
<script src=""></script>
<script src=""></script>
However, you can clearly see that the two output timestamps are identical, whereas I would have expected the conversion to subtract 1-2 hours, as Amsterdam timezone is GMT+2.

What am I doing wrong here?


Thành viên BQT
Timestamps in numeric form are always in UTC. If they've for some reason manually added/subtracted it by a time zone offset, they are doing it wrong. You don't see any change from moment, because a UTC timestamp is the same moment in time regardless of what time zone you represent the local time equivalent in. If you expected the timestamp to change, that would be representing an entirely different moment in time.