COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognosdelaware on 20 Oct 2017 01:16:10 PM

Title: Trying to get the length of a date field
Post by: cognosdelaware on 20 Oct 2017 01:16:10 PM
I have a date field and I need to check if it is 5 characters and if so format it as YYYYYMMDD

Some of the dates are stored as 5 characters(i.e. 70201 (represents 20070201)) or 6 characters(i.e. 150201(represents 20150201)

How can I convert the date so I can check the length of it for 5 characters?

Thanks
Title: Re: Trying to get the length of a date field
Post by: BigChris on 23 Oct 2017 02:16:53 AM
Are those the only two formats? And are they stored as strings or numbers? If it's stored as a number then I think you just need to add 2000000000, but the better solution would be to stored them as actual dates in your datawarehouse - you should be able to convert them in your ETL process on the way in.

Have people forgotten the millennium bug already...?