i would to get timestamp
by UTC Date
in javascript.
I searched and read other questions but i didn't find a solution.
I have this UTC Date 2017-07-16 12:00:07.8 UTC
but if i use .getTime()
it returns timestampt (milliseconds) in UTC removing another two hours.
I'm in Italy and here Date is UTC+2, maybe .getTime()
read data with Italy timezone and when returns timestamp removing that 2 hours? Is it possible?
var data= new Date(2017,06,16,12,0,7);
var mill= data.getTime();
alert(mill);
OUTPUT
1500199207
I hope you can help me and do not consider my question as duplicate. Thanks...
Use Date.UTC()
instead of new Date()
:
var mill= Date.UTC(2017,06,16,12,0,7);
alert(mill);
new Date()
assumes the values provided are for the browser's current timezone