date vs moment

Benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/moment.min.js"></script>

Setup

var dt_now = new Date();
dt_now.setMilliseconds(0);
var dt_now_text = moment(dt_now).utcOffset("+09:00").format('YYYY-MM-DD HH:mm:ss');

Test runner

Ready to run.

Testing in
TestOps/sec
date
dt_now_mil_sec = new Date(dt_now_text).getTime();
ready
moment
dt_now_mil_sec = moment(dt_now_text).valueOf();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.