r/AskJS•
throwaway60457

How to put a line break in the following?

<script style="text/javascript">

function updateCustomUTCClock() {

const month = \["January","February","March","April","May","June","July","August","September","October","November","December"\];

const now = new Date();

let monthname = month\[now.getUTCMonth()\];

// Get UTC components

const date = now.getUTCDate();

const hours = now.getUTCHours().toString().padStart(2, '0');

const minutes = now.getUTCMinutes().toString().padStart(2, '0');

const utcTimeFormatted = \`${monthname} ${date}, ${hours}:${minutes}Z\`;

// Display the formatted time

document.getElementById('clock').textContent = utcTimeFormatted;

}

// Update the clock every second

setInterval(updateCustomUTCClock, 1000);

// Initial call

updateCustomUTCClock();

</script>

Posted Jan 14, 2026, 12:11 AM UTC

10
Loading comments…