• 0

How to display the date?



I would like to know how to display the date and number of days between two dates.
For an example, I want to display today's date or current timestamp. Is there any possibility, that we can use any function (as like "getdate()" in SQL) to fetch the date/timestamp in any of the Widgets?
Also I want to know how to calculate and display the number of days between any particular dates.

Please help me on this.


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You can embed javascript in the Text Widget. Add Text Widget > Source button and enter in something like this:

<p id="today">[today]</p>
var d = new Date();
var date = d.getFullYear() + "/" + d.getMonth() + "/" + d.getDate()
document.getElementById('today').innerHTML = date;

Note that the javascript needs to be after the html code it modifies. I don't think you can use this javascript to modify other parts of the dashboard or extract data from monitoring because it's all contained inside an iframe. I also don't know if this will continue to work in the future.

If you need to get monitoring data into the widget, you might want to look at the various examples of datasources that directly modify widgets on these forums like: https://communities.logicmonitor.com/topic/2173-sql-results-table-display/#comment-5571

  • Upvote 1
Link to post
Share on other sites
  • 0

My thought for passing data from frame to frame was to write to temp properties of the dashboard and use them in the other widgets.  I was going to use something like this to make a slicer so you could have a list of devices in a graph and select which ones you want to have show up.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.