COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: EArumugam on 07 Oct 2009 02:03:34 AM

Title: Javascript to set date
Post by: EArumugam on 07 Oct 2009 02:03:34 AM
Hi All,

in my report having From and To date prompt.

I need to set it as Jul 1 and Jun 30 of the current fiscal year(2009)

eg:
from date shud be set to Jul 1,2008 and to date set to Jun 30, 2009


Any javasript to set this date.

thanks



Title: Re: Javascript to set date
Post by: CognosPaul on 07 Oct 2009 07:07:01 AM
Assuming the date prompts names are FROM and TO:

FROM:
<script>
function FiscalYearStart()
{
var strStartFiscal  = [new Date().getUTCFullYear()-1,7,30].join("-");
return strStartFiscal;
}
pickerControlPrompt[b]FROM[/b].setValue(FiscalYearStart() );
</script>


TO:
<script>
function FiscalYearEnd()
{
var strEndFiscal  = [new Date().getUTCFullYear(),6,1].join("-");
return strEndFiscal;
}
pickerControlPrompt[b]TO[/b].setValue(FiscalYearEnd() );
</script>