Search code examples
cognoscognos-10cognos-bi

How does the _first_of_month (current_date) Cognos function work?


How does the _first_of_month (current_date) Cognos function work?

If the current date today is September 8, does it return all the value from September 1 to September 8? Month to date. Or does is return the value of the past month? Does it only return a value of 1 day?

So if I have a column CreatedDate then I use the function like this.

[CreatedDate]=_first_of_month (current_date)

This is an example of the CreatedDate column.

enter image description here


Solution

  • _first_of_month() takes a date value and returns a date value corresponding to the first day of the month of the value passed in.

    Passing in: 2015-08-15 Returns: 2015-08-01

    Passing in: 2014-03-21 Returns: 2014-03-01

    Passing in: 1996-07-22 Returns: 1996-07-01

    It's key to remember that the type of the return value will be another date.