Help calculate the last day of the previous month

  • Hello again,

    I currently have an Access report expression "=DateSerial(Year(Date()),Month(Date()),0)" that pulls this date "Thursday, March 31, 2016". I am fairly new to SSRS and this expression does not seem to work in SSRS

    The only thing I can figure out for Reporting Services is this expression "=dateadd("m",0,dateserial(year(Today),month(Today),0))" which looks like this in my SSRS report "3/31/2016 12:00:00 AM".

    How can I get SSRS to show just the last day of the last month like this "March 31, 2016"?

    DP

  • I figured out how to remove the timestamp to only include 3/31/2016 "=FormatDateTime(dateadd("m",0,dateserial(year(Today),month(Today),0)))".

    I now need to know how to convert that to March 31, 2016.

    Any Ideas?

    DP

  • Like this?

    =DateAdd("d",-Day(Today()), Today())

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (4/14/2016)


    Like this?

    =DateAdd("d",-Day(Today()), Today())

    That didnt work for me. I used "=FormatDateTime(dateadd("m",0,dateserial(year(Today),month(Today),0)))" which shows up on my report as 3/31/2016. I just need to change that to March 31, 2016.

  • If you're trying to format a textbox, use the format property with the following value.

    MMMM dd, yyyy

    If you're trying to format a parameter, just don't. Use the date/time type.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (4/14/2016)


    If you're trying to format a textbox, use the format property with the following value.

    MMMM dd, yyyy

    If you're trying to format a parameter, just don't. Use the date/time type.

    Thanks for replying back Luis.

    My inexperience got the best of me here. I got it to work. I was trying to change the format by an expression. Dont know why but that was my thinking. Forgot that there is a date formatting option in the text box properties.

    Thanks again!

    DP

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

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