Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7985747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:38:43+00:00 2026-06-04T11:38:43+00:00

See the code: var fs = require(‘fs’); var file = e:/myfile.txt; fs.stat(file, function(err, stat1)

  • 0

See the code:

var fs = require('fs');

var file = "e:/myfile.txt";

fs.stat(file, function(err, stat1) {
  console.log(stat1.mtime);
  fs.stat(file, function(err, stat2) {
    console.log(stat2.mtime);
    console.log(stat1.mtime == stat2.mtime);
    console.log(stat1.mtime === stat2.mtime);
  });
});

And the result:

Sun, 20 May 2012 15:47:15 GMT
Sun, 20 May 2012 15:47:15 GMT
false
false

I didn’t change the file during execution. But you can see no matter == or ===, they are not equal.

How to compare two mtime in nodejs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:38:45+00:00Added an answer on June 4, 2026 at 11:38 am

    == on objects test if the objects are equal. However, < and > do the job propertly for Date objects, so you can simply use this function to compare the two objects:

    function datesEqual(a, b) {
        return !(a > b || b > a);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See the following nodejs code with async : var async = require('async'); function inc(n,
See this code: var jsonString = '{id:714341252076979033,type:FUZZY}'; var jsonParsed = JSON.parse(jsonString); console.log(jsonString, jsonParsed); When
Check the code var server = http.createServer(function(req, res){ var parsedUrl = require('url').parse(req.url); var pathname
Please see below code,i getting wrong value. eg; var FirstValue=0.00; var secondvalue=parseFloat(22.88,10).toFixed(2); var thirdvalue=(FirstValue)
I see a very common boilerplate pattern for bookmarklet code: javascript:var%20b=document.body;if(b&&!document.xmlVersion){void(/*do_something_AWESOME_here*/);}else{} What is the
I see a lot of code similar to the following var customrs = MyDataContext.Customers.Where(...);
See code just bellow Our generic interface public interface Repository<INSTANCE_CLASS, INSTANCE_ID_CLASS> { void add(INSTANCE_CLASS
See code below: I want Page 1 to alert #testing... This works in C
I frequently see code which involves iterating over the result of a database query,
Some times I see code like this: module Elite module App def app 'run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.