COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognos74 on 07 Nov 2016 11:53:31 AM

Title: How to get 12 Hour shift from Date/Timecolumn
Post by: cognos74 on 07 Nov 2016 11:53:31 AM
Hi

I am trying to get 12 hour shift from my Date Time column but no lucky.  can anyone please help me in this.

Recorded Date/Time is the column name. I need to get 12 hour shift our of that column which is everyday morning 7am to 7pm(12 hours)

thanks,
Title: Re: How to get 12 Hour shift from Date/Timecolumn
Post by: charlie on 08 Nov 2016 12:30:11 AM
Not sure if I am missing something in your requirement but this looks pretty straight to me. You can try writing a case statement that will look like the below (excuse syntax errors please).

case when extract(recorded_date,HH) between 7 and 19 then 'Day Shift'
else 'Night Shift' end

Title: Re: How to get 12 Hour shift from Date/Timecolumn
Post by: cognos74 on 08 Nov 2016 09:48:33 AM
Thank you very much Charlie,  logic worked perfectly..