I'm trying to get time once data is submitted off-chain, since only way to get on-chain is via now to get the block time.

Off-chain I'm using "document.getElementById("demo").innerHTML = Date()" to get live time once button is click.

My question here is, is there a way to type cast this html code to a string so that I could re-send it back to the block chain and save the time there?

I've tried var string1 = String(document.getElementById("demo").innerHTML = Date()); .. But that of course doesnt work.

Really appreciate your help.

  • This doesn't seem an Ethereum question but a programming 101. – ferit Jun 22 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.