Question: I've been trying to use a Single JavaScript object in multiple files. For that I chose singleton design pattern in JavaScript.

**mySingleton.js**

```
var mySingleton = (function () {
var instance;
function init() {
function privateMethod(){
    console.log( "I am private" );
}
var privateVariable = "Im also private";
var privateRandomNumber = Math.random();

return {

  publicProperty: "I am also public",
  publicMethod: function () {
    console.log( "The public can see me!" );
  },

  getRandomNumber: function() {
    return privateRandomNumber;
  }

  };

};

return { 

getInstance: function () {
  if ( !instance ) {
    instance = init();
    console.log("Newly creating an object");
  } 
  return instance;
} 
};
})();
module.exports = mySingleton;

```

And i'm Accessing the The above object in a separate node js file. As showed in following code

**test.js**

```
var singleton = require('./mySingleton');
var obj = singleton.getInstance();
console.log(obj.publicProperty);
console.log('random number value:'+obj.getRandomNumber());

```

**test2.js**

```
var singleton = require('./mySingleton');
var obj = singleton.getInstance();
console.log(obj.publicProperty);
console.log('random number value:'+obj.getRandomNumber());

```

When i execute the above two files each time a new javascript object is creating. But I want to use the same JavaScript object in multiple files.

Thanks in advance....

So Can anyone please give any suggestion to achieve the above functionality.

Answer: 
Looking at the issue Dateofbirth is probably a datetime column.

A datetime column has both a date part and time part.So, your query with date alone will translate as 

```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03 00:00:00.000'
AND Dateofbirth <= '2014-10-03 00:00:00.000'

```

So, to get the entire day the query should be like 

```
SELECT * FROM student
WHERE Dateofbirth >= '2014-10-03 00:00:00.000'
AND Dateofbirth <= '2014-10-03 23:59:59.997

```
As already mentioned, the time-part of your column (hour/minute etc) is the reason for that behavior.

In T-SQL, you can also use [DATEDIFF](http://msdn.microsoft.com/library/ms189794.aspx) to get the data for one specific date:

```
SELECT * FROM student
WHERE DATEDIFF(d, Dateofbirth, '2014-10-03') = 0

```