Search code examples
javascriptunixtimemomentjsepoch

How to add a millisec of time to this epoch?


1474148715 According to epochconverter it's: GMT: Sat, 17 Sep 2016 21:45:15 GMT

Trying momentJS, but no luck:

const startMomentized = moment(Date($state.params.start_epoch)).add(1, 'milliseconds').unix();

^ This gives me the date: GMT: Thu, 09 Feb 2017 19:39:43 GMT instead of the date in Sep 2016, I'm trying to have.


Hoping for something like the following:

var start = params.start_epoch;
var startUpdated = start+millisec;

Solution

  • The value represents time in milliseconds since 1970. You can add milliseconds directly to that number like: 1474148715 + 1