Display today’s date on dashboard using javascript

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on email

1. Add any box container or the icon that will display the date

Image

 

2. Next right click and select ‘Data source’

Image

 

In the connection drop down, select ‘Personal Cloud’ and in the SQL enter the following SQL

select 'dummy' as Today

3. In the javascript window add this following code

Image

 


//get today's date into the variable

var today = new Date();

/* our SQL will return one data element containing the value "dummy"
in the glb array at the first position determined by [0][0]
so we simply replace the data value with our javascript date value */

glb["_json"]["data"][0][0]=today.toString();

4. Click OK

And you will see that the date is formatted in the default javascript format and displayed as below

Image

If you need to display the date in different format then you can use the date functions

For e.g if you just need to display the date part and don’t need the timezone and time part then you can achieve this as below.


glb["_json"]["data"][0][0]=today.getFullYear()+"-"+(today.getMonth()+1)+"-"+today.getDate();

Image

SQL Method

Now the above method relied on the javascript to generate the date. But if you work with database then all SQL database provide a date function that you can use to display the current date.

For MySQL, you would use the now() function

select now() as "Today"

For Oracle

select sysdate as "Today' from dual

So find the appropriate database date/time function to display the dates on the dashboard.

The Core Tools

Create dashboard for any Database

Data Visualizer and Dashboard Application
SALE
This is the best dashboard software for its price. One good thing we did was to hire their consulting services to build few dashboard prototypes and provide some quick dashboard training.
- Terry Seal, IL
We evaluated Xcelsius and Qlikview and the cost for organization to implement dashboards was quoted over 10,000 USD. For fraction of the above quoted price, we were able to buy the licenses for the web based dashboard software and get some free training. This is truly a dashboard software for small businesses like us.
IT Manager of a Trucking company, OH