new Date(..).getTime()
is expected to provide a timestamp in milliseconds. In the documentation of momentJS, it states that the expression moment(..).valueOf()
should also yield a timestamp in milliseconds for a given date.
To verify this claim, I conducted a test with the following sample data:
var timeStampDate = new Date("2015-03-25").getTime(); //timestamp in milliseconds?
> 1427241600000
var timeStampMoment = moment("03-25-2015", "MMDDYYYY").valueOf(); //timestamp in milliseconds?
> 1427238000000
It turns out that the results were not identical.
Therefore, I am currently seeking a function within momentJS that can produce the exact same data as new Date(..).getTime()
.