console-timestamp
It's a simple date formatter for Node.js. Perfect for logging.
There's only one function.
You can call it with a string argument which becomes the format (defaults to hh:mm:ss
). It replaces specific parts of this string:
YYYY
with 4-digit YearYY
with 2-digit YearMM
with MonthDD
with Dayhh
with Hoursmm
with Minutesss
with Secondsiii
with Miliseconds
Examples
var timestamp = require('console-timestamp');
console.log(timestamp());
console.log(timestamp('DD-MM-YYYY hh:mm:ss:iii'));
console.log(timestamp('[SERVER TIME hh:mm]'));