简体   繁体   中英

SSRS BIDS 2008 Expression

What is the correct expression to use for todays date plus 1 year.

I assume it starts with Now()+ but im unsure from there

This page has lots of great examples, including:

=DateAdd(DateInterval.Month, 6, Parameters!StartDate.Value)

From that and the example before it, it looks like you want:

=DateAdd(DateInterval.Year, 1, Today())

this should be what your looking for:

--midnight last day of last month

select DateAdd(mm,-0,(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))))

--midnight last day of this month

select DateAdd(mm,+1,(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))))

--midnight last day of last month 1 year ago

select DateAdd(yy,-1,(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))))

--midnight last day of this month 1 year ago

select DateAdd(yy,-1,DateAdd(mm,+1,(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)))))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM