Date string update, midnight timer update, other stuff

This commit is contained in:
MrFry 2020-04-07 15:00:39 +02:00
parent c764c4f402
commit dbb23a6724
6 changed files with 92 additions and 61 deletions

View file

@ -10,7 +10,8 @@ module.exports = {
CreatePath: CreatePath,
WatchFile: WatchFile,
ReadDir: ReadDir,
CopyFile: CopyFile
CopyFile: CopyFile,
GetDateString: GetDateString
}
var fs = require('fs')
@ -19,6 +20,16 @@ var logger = require('../utils/logger.js')
const dataFile = './public/data.json'
function GetDateString () {
const m = new Date()
return m.getFullYear() + '-' +
('0' + (m.getMonth() + 1)).slice(-2) + '-' +
('0' + m.getDate()).slice(-2) + ' ' +
('0' + m.getHours()).slice(-2) + ':' +
('0' + m.getMinutes()).slice(-2) + ':' +
('0' + m.getSeconds()).slice(-2)
}
function CopyFile (from, to) {
CreatePath(to)
fs.copyFileSync(from, to)