How to Handle Time Conversion and Display in Dashboards
In some cases, there is a need to convert time data to milliseconds. However, this data might sometimes get stripped. This article provides a solution to this issue and also explains how to display this data on a dashboard in a 24-hour format.
Time Conversion to Milliseconds
To convert time data to milliseconds without stripping, you can use the following expression:
strftime('%d-%m-%Y %H:%M:%f', [column]/1000.0, 'unixepoch')
This expression is supported in SQLite database. The [column] field mentioned in the expression should be in Unix epoch format for this expression to work. Unix epoch time is a system for describing a point in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.
The expression will provide values till milliseconds as shown in the image below:
Expression Image:
Preview Image:
Displaying Time Data on Dashboard
The time data, once converted to milliseconds, can be displayed on a dashboard. The current expression provides the value in a 24-hour format. The image below shows a dashboard where the value is applied on a chart widget in a 24-hour format:
Dashboard Image:
By using the above expression and method, you can effectively convert and display time data till milliseconds on your dashboard.