diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index ffe6a2a892a27f5f3f4c13e15f1bba72ac898181..c75f652242b436cbb46a78ddeec29b217806109c 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -5843,6 +5843,7 @@ void tst_QScriptEngine::dateConversionJSQt()
         QDateTime qtDate = jsDate.toDateTime();
         QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate);
         QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString();
+        jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000")
         if (qtUTCDateStr != jsUTCDateStr)
             QFAIL(qPrintable(jsDate.toString()));
         secs += 2*60*60;
@@ -5856,6 +5857,7 @@ void tst_QScriptEngine::dateConversionQtJS()
     for (int i = 0; i < 8000; ++i) {
         QScriptValue jsDate = eng.newDate(qtDate);
         QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString();
+        jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000")
         QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate);
         if (jsUTCDateStr != qtUTCDateStr)
             QFAIL(qPrintable(qtDate.toString()));