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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can _Age function return negative values

Status
Not open for further replies.

spattewar

Technical User
Oct 19, 2001
29
0
0
US
HI,
I am using cognos 8.0 and want to filter records based on the system date. But there is a possiblity that the dates in the database are greater than the system date due to different time zones and people from different zones updating the database. So if I want to get all the records from the database that have the last update date as system date or greater than system date, than can I use the _Age function?

something like

(_age(cast([DateLastUpdated],date)) =< 0)

Thanks a lot for your help!

Regards,
$wapnil
 
Check it out with:

Code:
_age(_last_of_month(current_date))

This will net you negative values for any day that is not the last day of a month.

(-1 for today's date of 30 may 2007)



Ties Blom

 
Hi. Ties. Thanks for your reply.

Will this also help me for lets say if I run the report now on 30th May 2007 I will get data which has last updated date as >= 30th May 2007. ie for e.g. 31st May 2007.

Thanks again.

$wapnil
 
My example was just to proof that the _Age function can yield negative values.
If you want to play with restriction on dates in the future you may as well use:

Code:
_add_days(current_date;7)

Which will yield 6 june 2007.

Ties Blom

 
that is great. I can use this now.

Also with the _age function if the DateLastUpdated is 31st may

then

(_age(cast([DateLastUpdated],date))) will yield - 1. Am i correct.

Thanks again.

$wapnil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top