Vinez
asked on
Cognos 8.2 Report Studio, date-to-string
I'm trying to format two date fields in Cognos 8.2 Report Studio. The two date fields are Project Start Date and Project End Date. The result should display in this format, mm/yy - mm/yy. So far I have I've got the format, however I need the month to always be two characters, for example January would 01 instead of 1. Please see my code below. What I have now works but does not give me two characters for month. Can someone help with this?
substring(cast(extract(mon th,[Projec t Start Date]),VARCHAR(10)),1,2) + '/' + substring(cast(extract(yea r,[Project Start Date]),VARCHAR(10)),3,2) + ' - ' + substring(cast(extract(mon th,[Projec t End Date]),VARCHAR(10)),1,2) + '/' + substring(cast(extract(yea r,[Project End Date]),VARCHAR(10)),3,2)
thanks,
vinez
substring(cast(extract(mon
thanks,
vinez
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Vinez,
I hope that you found your answer. Just in case you did not, my question is why are you coding the format? In Report Studio, you can simply add a text item and change the source to Data Item Value. Select your date field and choose the data format property. In that dialog you can specify the format. If you want to insure that two positions are shown, just enter a format string in the "Pattern" option.
Cheers!
I hope that you found your answer. Just in case you did not, my question is why are you coding the format? In Report Studio, you can simply add a text item and change the source to Data Item Value. Select your date field and choose the data format property. In that dialog you can specify the format. If you want to insure that two positions are shown, just enter a format string in the "Pattern" option.
Cheers!
ASKER
I did find the answer but that is a great tip. Thank you.
ASKER
substring(cast(extract(mon