COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: bartburg on 07 Jan 2014 03:39:08 AM

Title: char to date
Post by: bartburg on 07 Jan 2014 03:39:08 AM
Hi,

i got a field i want to report on this field i want to do a differance between current date -2 months and the field.
the field i get from the database contains text that looks like a date "2014-01-01" but when i see its properties it says
characterLength16 so its not a date field.
how can i still perfom the function or can i query the field like a date?
Title: Re: char to date
Post by: BigChris on 07 Jan 2014 04:06:49 AM
It depends on your platform etc. but I'f look at the _make_timestamp expression. You'll need to substring the data field that you've got at the moment, so you'd end up with something like:

_make_timestamp(substring([DateField],1,4), substring([DateField],6,2), substring([DateField],9,2))

There might be a more elegant solution, but that should work at least.

C
Title: Re: char to date
Post by: bartburg on 07 Jan 2014 07:07:06 AM
where do i enter this  expression?