This is a way to overcomplicated script. First we get local computer time using javascript, their timezone, and GMT code using:
var timeZoneData = Intl.DateTimeFormat().resolvedOptions().timeZone;
var rightNow = new Date();
var visitorTimeZone = "GMT" + -(rightNow.getTimezoneOffset() / 60);
Then we make a GET ajax to a php server which runs a API request to pull back a webinar schedule it returns html of the next webinar which is pulled back and displayed as:
Thursday, 13 Dec 12:30 PM
I need to output it at a different format so a countdown timer can recognise it which is
Dec 13, 2018 12:30:00
I simply, for the life of me cannot work out how to do it. Here is my ajax request:
$(document).ready(function(){
var timeZoneData = Intl.DateTimeFormat().resolvedOptions().timeZone;
var rightNow = new Date();
var visitorTimeZone = "GMT" + -(rightNow.getTimezoneOffset() / 60);
$.ajax({
type: "GET",
url: "URLTOGETTHESTUFFWHICHPULLSBACK",
data: 'GMT='+visitorTimeZone,
dataType: "html", //expect html to be returned
async: false,
success: function(msg){
$('#nextWebinarForm').html(msg +' - ' + timeZoneData);
}
});
$("#gmt").val(visitorTimeZone);
document.getElementById('timezonedata').innerHTML=timeZoneData;
});
Then I do some magic vudo stuff and then I have my countdown timer: https://codepen.io/AllThingsSmitty/pen/JJavZN Which I clearly am just using someone elses pen because I don't know how to write one.
PLEASE HELP.