Date Parameter Questions

  • Hi,

    I'm trying to set start and end date parameters. They have to be from the same month and year. How can I do that? I'm thinking from the stored procedure, but not sure how.

    Thanks,

    Melissa

  • Hi

    Write following expression in Non-queired option of Default values:

    =CDate(Format(now(),"M/d/yyyy"))

    It'll work fine..

    Do you need something different?

  • Are you trying to set them in the Report Manager GUI for running a report? If so, the calendar will most likely not work for you. Have you tried using a drop down and then cascading the values from the "from" to the "to"?

  • Excuse me, but I don't understand what you want exactly.

    If you want to obtain Start and End of the month from one parameter datetime, you can make something like that:

    DECLARE @Date datetime

    DECLARE @StartMonth datetime

    DECLARE @EndMonth datetime

    SET @Date = '2008-06-26'

    SET @StartMonth = CONVERT(DATETIME, CONVERT(CHAR(08), @Date, 121) + '01', 121)

    SET @EndMonth = DATEADD(dd, -1, DATEADD(m, 1, @StartMonth))

    SELECT @StartMonth, @EndMonth

  • I think what's desired just needs a slightly different way to go about it. Start by having 4 parameters. One for the year, one for the month, and then one for the start day and one for the end day. That way, you can just construct the date from the parameters supplied.

    Steve

    (aka smunson)

    :):):)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply