I am converting Miliseconds to date and time using moment It gives me correct output as expected but while converting same date+time it gives me wrong output.
I have used unix,valueOf moment methods.
const moment = require('moment-timezone');
console.log(moment.tz(1567032260763,'x','America/Chicago').format('MM-DD-YYYY hh:mm:ss A')) //gives me 08-28-2019 05:44:20 PM which is right.
console.log(moment('08-28-2019 05:44:20 PM','MM-DD-YYYY hh:mm:ss A').valueOf()); // gives me 1567032260000 instead of 1567032260763
Please guide where I am wrong!
Date.UTC(2019,7,28,23,52,43))
. – Rootsmoment.tz(...)
, notmoment(...).tz(...)
..tz(...)
is a conversion to a timezone (momentjs.com/timezone/docs/#/using-timezones/converting-to-zone). – Capitoltimezone
– Leadsman