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

Date time to Date

Started by phoenixfire, 19 Jan 2009 01:20:11 PM

Previous topic - Next topic

phoenixfire

Hello,
Can someone help me out here?
If I need to convert Date-Time Stamp to a Date stamp, how can I do it?
The prompt page has a date-time parameter. But this parameter needs to be displayed on the report page as only a date (without the time).
thanks in advance

jshanks

Hello:

There are several methods you can use to accomplish this:

1.  Set the data item format for the datetime column to "Date".  This changes the format of the display only.

2.  Create a calculated column that converts the datetime to a date within your report query:

     cast([date_column], date)

3.  Use a function that is native to your database to convert from datetime to date:

     Oracle:  TO_DATE([date_column], 'DD-MM-YYYY')
     
     SQL Server 2005:  DATEADD(dd, 0, DATEDIFF(dd, 0, [date_column]))

phoenixfire

Thank you for your reply. I have actually tried all of these methods. But these work only for query items, not for parameters. If I enter say start date 01-01-2009 12.00 AM in the prompt page, it still shows up as Jan 1 2009, 12:00 AM.

Have you used these methods for parameters before?

jshanks

Is your parameter required?  If so, you can create a query item with the following calculation: cast(?Parameter1?, date) and then place that query item in your report.

Cognos does supply some data type conversion functions that can be used on Layout Calculations.  However, I was not able to get them to work in my test report.

phoenixfire

Hello jshanks,
Will try this method tomorrow and let you know...thank you for the effort either way.

sandeep8000861

phoenixfire:

Please include each of your parameters in a separate data item and use the filters on these new data items. This is how i overcame the issue.
This will work for you, i think. Worked for me, though!

jshanks:
Thanks very much. :-)