Current time with custom format?

I have used a F’inSweet hack to get the current time for different offices on the contact page.

However, instead of the “standard” 24-hour format, the designer would like the time to appear like “// 16H30”

I have been digging through the documentation on the Intl.DateTimeFormat() constructor to see if there is a way to do it and I am blurry-eyed trying to read through it. There are a gazillion options, but I don’t think that code will do output a truly custom format.

Does anyone else have any ideas on how to do this?

Thanks so much

Here is my site Read-Only

hi @williamb here is simple example how to

const timeVersion1 = {
	timeZone: 'America/New_York', //use any time zone in the TZ database name column
	hour12: false,
	hour: '2-digit',
	minute: '2-digit'

// store timezone result
const tzOne = new Date().toLocaleTimeString('en-US', timeVersion1);
// modify output
document.querySelector('.is--time-toronto').innerHTML = `// ${tzOne.slice(0, 2)}H${tzOne.slice(3,5)}`; 

rendered time format is like this // 05H00

1 Like

Thank you so much, Stan! That worked perfectly!