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
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]))
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?
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.
Hello jshanks,
Will try this method tomorrow and let you know...thank you for the effort either way.
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. :-)