COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: philelmousse on 08 Sep 2011 06:06:17 AM

Title: make_timestamp of last day of a month
Post by: philelmousse on 08 Sep 2011 06:06:17 AM
I would like create a timestamp with the last day of a month. I have a prompt with the month and the year but for the day I dont know how generate the last day of the selected month.

I only have make_timestamp(?Year?,?Month?,) for now... What could I put for the third parameter ?
Title: Re: make_timestamp of last day of a month
Post by: philelmousse on 08 Sep 2011 06:11:41 AM
Just found it...

_make_timestamp (  ?year?,?Month?,_days_to_end_of_month (_make_timestamp (  ?year?,?Month?,0  )))
Title: Re: make_timestamp of last day of a month
Post by: philelmousse on 08 Sep 2011 09:21:17 AM
the '0' value in the make_timestamp returns that error :

UDA-SQL-0114 The cursor supplied to the operation "sqlOpenResult" is inactive. UDA-SQL-0564 [Microsoft OLE DB Provider for SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. (SQLSTATE=22007, SQLERRORCODE=242)

What could I use ?
Title: Re: make_timestamp of last day of a month
Post by: sjfamily84 on 08 Sep 2011 11:11:40 AM
Would the 1st day of the next month, minus 1 day work?
Title: Re: make_timestamp of last day of a month
Post by: Lynn on 08 Sep 2011 02:43:03 PM

Quote_last_of_month ( date_exp )
Returns a date or datetime, depending on the argument, that is the last day of the month represented by "date_exp".


_last_of_month( _make_timestamp (  ?year?, ?Month?, 1  ) )
Title: Re: make_timestamp of last day of a month
Post by: philelmousse on 09 Sep 2011 03:17:21 AM
thanks !