Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Time difference

Hi all,

I have got a column named 'Last_Modified' which displays the data in 'MM/DD/YYYY HH:MM:SS' format.

Now all I want is to calculate the difference between the 'last modified' data to current local time and to display the output in HH:MM:SS format in a straight table.

Example data

Last_Modified

3/9/2013       2:00:01 AM

2/21/2013  10:54:32 PM

.

.

.

.

2/12/2012   11:34:22AM

Any help would be appreciated.

Regards,

Priya

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Priya,

That would be an expression in your table:
interval(now() - Last_Modified, 'hh:mm:ss')

But using function now() on the front end is problematic because it will be evaluation current time every moment.  Use now(2) to get the time of document openeng or now(0) for the last reload time.

Regards,
Michael

View solution in original post

5 Replies
Not applicable
Author

Hi ,

     Try the below code

=Interval( Timestamp( Today(), 'DD/MM/YYYY hh:mm:ss' )-Timestamp#(MyFieldName,  'DD/MM/YYYY hh:mm:ss'))

//yusuf

Not applicable
Author

Priya, I recommend the now() function. So dimension = Last_modified, Expression would be something like time(now(0,1,or 2)-Last_modified).

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

try: interval(now() - timestamp#(Last_Modified,'MM/DD/YYYY hh:mm:ss') ,'hh:mm:ss')

Or in the script:

Let vNow = now();

Table1:

load

     Last_Modified,

     interval( $(vNow) - timestamp#(Last_Modified,'MM/DD/YYYY hh:mm:ss') ,'hh:mm:ss') as TimeDiff

from ...somewhere...;


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Priya,

That would be an expression in your table:
interval(now() - Last_Modified, 'hh:mm:ss')

But using function now() on the front end is problematic because it will be evaluation current time every moment.  Use now(2) to get the time of document openeng or now(0) for the last reload time.

Regards,
Michael

Not applicable
Author

Thanks Michael.

Its really helpful ..It works