Date set string VS integers

Benchmark created by jpvincent on


Description

compare 4 ways to define Dates in Javascript : string, integer, timestamp and methods

Test runner

Ready to run.

Testing in
TestOps/sec
Set date with String
var date = new Date('February 13, 2009 14:53:27');
date.getTime();
ready
Set date with Integer
var date = new Date(2009, 1, 13, 14, 53, 27);
date.getTime();
ready
Set date with timestamp
var date = new Date(1234533207000);
date.getTime();
ready
Set date with methods
var date = new Date();
date.setFullYear(2009);
date.setMonth(1);
date.setDate(13);
date.setHours(14);
date.setMinutes(53);
date.setSeconds(27);
date.getTime();
ready

Revisions

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

  • Revision 1: published by jpvincent on