The following script generates the following output: "Sun Feb 23 2020 06:35:14 GMT-1000 (HST)"
I would like to strip out "GMT-1000 " and display only "Sun Feb 23 2020 06:35:14 (HST)".
I don't know where the GMT-1000 is generated, so can't understand how to implement
str.replace("GMT-1000", " ");
What can I do?
function display_c(){
var refresh=1000; // Refresh rate in milli seconds
mytime=setTimeout('display_ct()',refresh)
}
function display_ct() {
var x = new Date()
document.getElementById('ct').innerHTML = x;
var ct = str.replace("GMT-1000", " ");
display_c();
}
Ghoul Ahmed :
try this\n\n\r\n\r\nconst date = 'Sun Feb 23 2020 06:35:14 GMT-1000 (HST)';\r\nconst convertDate = date => new Date(date).toUTCString().split(' ').slice(0, 5).join(' ');\r\nconsole.log(convertDate(date));",
2020-02-23T17:08:55