# Date and Time - HTML Widget

**URL:** <https://forums.knack.com/t/date-and-time-html-widget/7645>\
**Category:** Ask Developers\
**Created:** [May 7, 2016, 4:03pm UTC](https://forums.knack.com/t/date-and-time-html-widget/7645 "2016-05-07T16:03:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guilhermeb42087](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@Guilhermeb42087](https://forums.knack.com/u/Guilhermeb42087)\
**Post date:** [May 7, 2016, 4:03pm UTC](https://forums.knack.com/t/date-and-time-html-widget/7645/1 "2016-05-07T16:03:38Z")

</div>

I'm trying to install a widget provided by [http://time.is/widgets](http://time.is/widgets).

It's a simple html code generated by their site. I tried to simply copy it inside a richtext field, but it wont work. I set the richtext to html mode, but nothing happened. Does anyone knows what should I do to make the date/clock work?

```
<a href="http://time.is/São_Paulo" id="time_is_link" rel="nofollow" style="font-size:20px">Time in São Paulo:</a>
<span id="_z17b" style="font-size:20px"></span>
<script src="http://widget.time.is/pt.js"></script>
<script>
time_is_widget.init({_z17b:{id:"São_Paulo_z17b", template:"TIME<br>DATE", time_format:"12hours:minutes:secondsAMPM", date_format:"dayname daynum/monthnum/yy"}});
</script>
```

---

<div class="post-metadata">

**Author:** ![Guilhermeb42087](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@Guilhermeb42087](https://forums.knack.com/u/Guilhermeb42087)\
**Post date:** [May 27, 2016, 5:10pm UTC](https://forums.knack.com/t/date-and-time-html-widget/7645/2 "2016-05-27T17:10:37Z")

</div>

Here is the code. Just create a richtext field and html it inside:

```
<script type="text/javascript">;
function updateClock() {
//© OBH 2016 - www.oliverboorman.biz 
var days = ["Domingo - ","Segunda-Feira - ","Terça-Feira - ","Quarta-Feira - ","Quinta-Feira - ","Sexta-Feira - ","Sábado - "];
var months = ["01","02","03","04","05","06","07","08","09","10","11","12"];
var now = new Date();
var day = now.getDay();
var date = now.getDate();
var month = now.getMonth();
var year = now.getFullYear();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
if(date<10) date = "0" + date;
if(hour<10) hour = "0" + hour;
if(minute<10) minute = "0" + minute;
if(second<10) second = "0" + second;
var firstRow = hour + ":" + minute + ":" + second + '';
document.getElementById("row1").innerHTML = firstRow;
var secondRow = days[day] + " " + date + "/" + months[month] + "/" + year + '';
document.getElementById("row2").innerHTML = secondRow;
setTimeout("updateClock()",1000);
}
</script>
<time id="row1"></time>
<time id="row2"></time>
<script type="text/javascript">updateClock();
</script>
```

---

<div class="post-metadata">

**Author:** ![StevanLECO51061](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@StevanLECO51061](https://forums.knack.com/u/StevanLECO51061)\
**Post date:** [May 11, 2016, 8:43am UTC](https://forums.knack.com/t/date-and-time-html-widget/7645/3 "2016-05-11T08:43:10Z")

</div>

Yes you can add widget and choose where to put it in your app using API/CODE \> Javascript.

It requires some coding skills as you have to use js or Jquery to modify your page HTML structure on page render.

Nothing impossible though.

---

<div class="post-metadata">

**Author:** ![DougNelson66324](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/dougnelson66324/32/132_2.png) [@DougNelson66324](https://forums.knack.com/u/DougNelson66324)\
**Post date:** [May 9, 2016, 8:52pm UTC](https://forums.knack.com/t/date-and-time-html-widget/7645/4 "2016-05-09T20:52:19Z")

</div>

The rich text field is just for displaying text, using HTML formatting. It won't actually execute the HTML and call the widget that you want.

  

There may be a way to call the widget using javascript, but I'm not sure that you can put it in a specific place on a form or page, for example. I'd be very interested in the ability to add an HTML widget to a form, but I don't think it exists in Knack right now.
