Posts

Showing posts from March, 2012

Default date prompt behavior in a report

Image
Requirement : For a month to day report, always default the Start Date prompt to the first of the month Step 1 : Create a Time & Date prompt on the prompt page Step 2 : Give the prompt a specific name (ex: StartDate in this example) Step 3 : Drag an HTML item to the right of the prompt as shown below Step 4 : Paste the following script into the HTML Item <script type = "text/javascript"> // Function returns the first day of the month for the current month function MonthFirstDay () { // Create a new variable to store today's date var vCurrDate = new Date(); // Truncate the date to first of the month of this year var vFirstDay = new Date(vCurrDate.getFullYear(), vCurrDate.getMonth(), 1); // Convert the date in vFirstDay variable to a string value var vStrDay = [vFirstDay.getUTCFullYear(), vFirstDay.getMonth()+1, vFirstDay.getDate()].join("-"); // Return the date return vStrDay ; } // Function returns the time entere