var express = require('express'); var router = express.Router(); /* GET users listing. */ router.get('/', function(req, res, next) { var now = new Date(); var cur_date = '0' + now.getDate().toString(); var cur_month = '0' + (now.getMonth() + 1).toString(); var cur_year = now.getFullYear(); var cur_hour = '0' + now.getUTCHours().toString(); var cur_mins = '0' + now.getUTCMinutes().toString(); var cur_sec = '0' + now.getUTCSeconds().toString(); var date = cur_year + '-' + cur_month.slice(-2) + '-' + cur_date.slice(-2); var time = cur_hour.slice(-2) + ":" + cur_mins.slice(-2) + ":" + cur_sec.slice(-2); var t = {"zulu":now, "utc":now.toUTCString(),"date":date, "time":time}; res.writeHead(200, {"ContentType": "application/json"}); //res.send(JSON.stringify(t)); res.end(JSON.stringify(t)); }); module.exports = router;