Date query in SSRS

  • I currently use the expressions:

    =today.adddays(1-today.day)

     
    =Today.AddDays(1-Today.Day).AddMonths(1).AddSeconds(-1)

    to get the first and last day of the current month (last day I need to include seconds).

    Is there a way of tweaking these expressions to bring through the first day and the last day (inc seconds) of the previous month?

    Any advice gratefully accepted.

    Thanks

  • First day of previous month:
    =DateAdd("M", DateDiff("M", "01/01/2000", Today())-1, "01/01/2000")
    Last day of previous month:
    =DateAdd("d", -1,DateAdd("M", DateDiff("M", "01/01/2000", Today()), "01/01/2000"))

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • thanks for the very quick reply. Is there a way to include seconds in expression 2, so it would read 30/11/2017 23:59:59 ?

    Thanks again

  • faulknerwilliam2 - Wednesday, December 13, 2017 5:07 AM

    thanks for the very quick reply. Is there a way to include seconds in expression 2, so it would read 30/11/2017 23:59:59 ?

    Thanks again

    Take a second away, instead of a day,

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • excellent, has worked: many thanks

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

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