VBScript for Date Range from (Now) RRS feed

  • Question

  • I am not too familiar with VBScript and have only needed to use it on rare occasions. Currently, I am trying to report projects that have a Completion Date that falls between -18 months and -16 months from today's date. So the date entered in the Completion Date would be in the past. Let's say the field I am pulling from is titled {Completion Date}. 

    I came across this, and replaced "AddHours" with "AddMonths" and adjusted the end date to (-16).

    Code Snippet

    Dim startDate As Date = Now.AddHours(-18)

    Dim endDate As Date = Now.AddHours(-17)

    I ended up entering something like this, but it doesn't seem to be a valid expression. I know I'm way off, but it's a start.

    {Completion Date} = Dim startDate As Date = Now.AddMonths(-18)
    Dim endDate As Date = Now.AddMonths(-16)

    Any help would be much appreciated.

    Monday, April 4, 2016 5:24 PM

All replies