javascript conversion string to UTC date -
i'm converting string timestamp using
var timestamp = new date(month+"/"+day+"/"+year).gettime()/ 1000;
my question how set utc timezone before converting timestamp ?
use date.utc()
method instead of .gettime()
.
var timestamp = date.utc(year,month,day) / 1000;
(note: month expected 0-11, not 1-12.)
Comments
Post a Comment