display current time

Is it possible to display the current date time in a page?  Thank you.
1 answers

Yes, but way more difficult than you might think. The way you describe your question you seem not to have to store the datetime in the database, so this is a Mendix way of doing that:

  • from the appstore download the HTML-widget
  • add a textelement to the page giving it in tab General, in block Common the value Name ‘TickingTime’
  • Below that, add the HTML-widget to the page, selecting Javascript, not HTML nore Javascript with jQuery
setInterval(function(){ document.getElementsByClassName('mx-name-TickingTime')[0].innerHTML = new Date();}, 1000);