If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Add/Subtract minutes/hours from dateTime?

Started by kaevne, 30 Jan 2009 05:54:28 PM

Previous topic - Next topic

kaevne

We are trying to subtract minutes and hours from a user-selected datetime and seem to have run into a roadblock.  Cognos has _add_days, _add_months, and _add_years functions, but no _add_minutes or _add_hours functions!  Anyone know how to do so?  Thanks!

John_Russell

You have to get pretty creative with this one!  The following formula seems to have worked well for me.  Just substitute your date/time fields for my dummy start/end times and you should be golden.

mod((24+(to_number(to_char([END_TIME];'SSSSS') - to_char([START_TIME];'SSSSS')) /3600)),24)

kaevne

Thanks John.  We're trying it out right now. Much appreciated.