Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Intl.DateTimeFormat performance edit
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
Using Intl.DateTimeFormat
45532.9 Ops/sec
using Date
47594.3 Ops/sec
Script Preparation code:
var now = new Date() var targetHour = 9 var timezone = 'America/Toronto'
Tests:
Using Intl.DateTimeFormat
const formatter = new Intl.DateTimeFormat(undefined, { timeZone: timezone, hour: 'numeric', minute: 'numeric', second: 'numeric', }) const currentTime = formatter.format(now) // Extract the hour part and convert it to a number const currentHour = parseInt(currentTime.split(':')[0], 10)
using Date
const currentTime = now.toLocaleTimeString('en-US', { timeZone: timezone, hour12: false }); // Extract the hour part and convert it to a number const currentHour = parseInt(currentTime.split(':')[0], 10);