Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two timestamp

Hi,

I am facing a problem in QV11 to figure out the difference between two timestamps, for e.g. (column1) 04-08-2012 05:12:11 AM - (column2) 04-08-2012 05:11:11 PM.

Kindly help me out. Thank you in advance.

Regards

Ram

13 Replies
swuehl
MVP
MVP

Try something like this in your script

SET TimestampFormat='DD-MM-YYYY hh:mm:ss TT';

LOAD

field1,

field2,

interval(field1-field2) as TimeStampDiff

FROM YourTable;

Or in a chart expression

=interval(field1-field2)

sreenivas
Creator III
Creator III

=Date('04-08-2012 05:12:11','DD-MM-YYYY hh:mm:ss') -Date('04-08-2012 05:11:11','DD-MM-YYYY hh:mm:ss')

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=Interval(Num(Date#('04-08-2012 05:11:11 PM', 'DD-MM-YYYY hh:mm:ss tt')) - Num(Date#

('04-08-2012 05:12:11 AM', 'DD-MM-YYYY hh:mm:ss tt')))

will give you result as 11:59:00

Hope this helps you.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=Interval(Num(Date#('04-08-2012 05:11:11 PM', 'DD-MM-YYYY hh:mm:ss tt')) - Num(Date#

('04-08-2012 05:12:11 AM', 'DD-MM-YYYY hh:mm:ss tt')))

will give you result as 11:59:00

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Thank you sparing your time for this. I think AM PM thing is not used in your answer, even hourly difference need to be tracked.

Not applicable
Author

Nice it works if its hardcoded..can we do the same dynamically...?

Thank you very much for your solution and time

sreenivas
Creator III
Creator III

Yes instead of time add the fieldname

Not applicable
Author

with column name its not giving me correct output

sreenivas
Creator III
Creator III

Can you send the date format of the field