var newTimes = function () {
var today = new Date();
var options = {timeZone: 'UTC', timeZoneName: undefined};
var currentTime = new Date().toLocaleTimeString('en-GB');
var date = today.getFullYear()+"-"+(today.getMonth()+1)+"-"+today.getDate();
var setStartTime= new Date().setHours(07,30,00);
var getStartTime= new Date(setStartTime).toLocaleTimeString('en-GB');
var setClosingTime = new Date().setHours(16,30,00);
var getClosingTime = new Date(setClosingTime).toLocaleTimeString('en-GB');
var setFridayClosingTime = new Date().setHours(12,30,00);
var getFridayClosingTime = new Date(setFridayClosingTime).toLocaleTimeString('en-GB');
var day = new Date().getDay();
return {
today: today,
currentTime: currentTime,
date: date,
startTime: getStartTime,
closingTime: getClosingTime,
fridayClosingTime: getFridayClosingTime,
day: day
};
}
var times = newTimes();
var timeofDay = times.currentTime;
var start = times.startTime;
var closing = times.closingTime;
var fridayClosing = times.fridayClosingTime;
var dayofWeek = times.day;
console.log(timeofDay);
console.log(start);
console.log(closing);
console.log(fridayClosing);
console.log(dayofWeek);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.