This is my first time (yep JS newbie) using new Date()
and getDay()
functions in Javascript. The current date given is correct, yet it gives me the day as Friday even thought it shows the day as Thursday if I get current date. I did do a check of previous questions on here but couldn't see any that really explained it. It gives the same result in both Chrome and Firefox. I also checked that my computer is set to the correct time zone, UK GMT.
Code:
var currentDate = new Date();
console.log(currentDate);
var weekday = ['Mon', 'Tues', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun'];
var day = weekday[currentDate.getDay()];
console.log(day);
Time and day show in Console:
"Thu May 11 2017 22:25:15 GMT+0100 (BST) Fri"