This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Dave Marchuk
Posted Jan 18 - Read on Facebook

Apologies for the multitude of questions, but I have to ask one more:

I'm trying to display the current system time within a view that I've created, but I can't figure out how to get the time to display there.

All of the tutorials I've checked out say to use document.write, which puts it in the wrong place, or document.getElementById, but I'm getting "Cannot set property 'innerHTML' of undefined" errors.

I can get the time to display, but not within the element I need it in.

So far I have:

var timeDisplay = new View(); = {
"border":"2px solid red", // for testing

function today(view) {
todayDate = new Date();
document.view.innerHTML = todayDate.getHours(),":",today.getMinutes();


Can anyone give me a hand on how to accomplish this?


Koen Bok

I think you are looking for something like this:

Dave Marchuk

Thanks Koen! Love the bonus effect LOL

Dave Marchuk

Hey Koen, I've encountered an issue with the time script: If the time is like 12:09, it's appearing as 12:9, and 12:10 is appearing as 12:1... I've checked online for a fix for this but I'm not having much luck finding one that I can port over... any ideas?

Brett Holcomb
view.html =
now.getHours() + ":" +
now.getMinutes() + ":" +
(now.getSeconds() < 10 ? '0'+now.getSeconds(): now.getSeconds());

Dave Marchuk

Thanks Brett! Worked like a charm. The ones I found didn't integrate well, but yours solved the problem!

Read the entire post on Facebook