forked from ewintec/nodejs-rinho-udp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.js
23 lines (21 loc) · 786 Bytes
/
util.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Get Date Time
exports.getDateTime = function () {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
if (month.toString().length == 1) month = '0' + month;
if (day.toString().length == 1) day = '0' + day;
if (hour.toString().length == 1) hour = '0' + hour;
if (minute.toString().length == 1) minute = '0' + minute;
if (second.toString().length == 1) second = '0' + second;
var dateTime = year+'/'+month+'/'+day+' '+hour+':'+minute+':'+second;
return dateTime;
}
// Muttable Console Log
exports.log = function(message, type, muttable) {
if (!muttable) console.log(this.getDateTime() + " " + message);
}