Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtracting Dates

Status
Not open for further replies.

ClevelandKate

Technical User
Jun 13, 2012
1
US
Good morning. Using Report Studio in Cognos 8. I'm a whiz at Excel but those rules don't all aply in Cognos. :) Anyway, I'm largely self taught and making progress, but this is one of those things that I'm sure is very simple, but I can't find it.

My boss wants a report that compares two time fields. One is a time given by a vendor when he claims he made a delivery. The second is the time our location reports receiving the delivery.

Field format is MM/DD/YYYY HH:MM:SS

ex: 4/1/2012 8:56:00 PM and 4/1/2012 9:33:00 PM
I'd like to be able to calculate the difference in minutes, for this one it would be 37, and then filter the report to only show items with a diff of over 60 mintes.

I'm sure there's a function to subtract the dates, but everything I've tried just errors out.

Any suggestions?

K8
 
I would write an extended expression using the Cognos extract function. You can extract year,day,hour and minute from a timestamp and convert this to an overall figure in minutes.

The complexity lies in the difference between the 2 dates. If only the time component differs than it is a matter of calculation hours*60+minutes and subtracting the two numbers accordingly..


Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top