Monday, 15 September 2014

Node.js & Javascript / Date object - take time before x hours -



Node.js & Javascript / Date object - take time before x hours -

i have script in node.js find files in specific directory, , takes modified time:

fs.stat(path, function(err, states){ console.log(states.mtime) })

and prints me following:

sun aug 31 2014 11:40:14 gmt-0400 (edt)

i want print files modified before 6 hours now.

is info object back upwards it?

fs.stat(path, function(err, states){ if (state.mtime < new date() - (6*60*60*1000)) { console.log(states.mtime) } })

only print if date less current date - 6 hours.

javascript node.js

No comments:

Post a Comment