Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Welcome to my blog. I work as Database lead at Synaptic Digital. Hope you find some interesting stuff here.
Browse by Tags · View All
BRH 17
SQL Server 15
#SQL Server 11
#BI 10
#TSQL 8
TSQL 8
BI 7
SSRS 6
#SQLServer 6
SSRS 2008R2 5

Archive · View All
January 2011 6
December 2010 5
September 2012 4
May 2012 4
March 2011 4
November 2012 2
October 2012 2
January 2012 2
February 2011 2
November 2010 2

Different Date Calculations in SSRS

Apr 14 2011 5:44PM by Chintak Chhapia   

While designing the reports, we need to set default date values in Date data type parameter.  This question also appears many times in forums. So, I decided to create a comprehensive list of all such expressions.

Now, In expression editor we can use native VB functions for different date calculation and we can also use .Net Properties and Methods for doing the calculation. So, one case use any one based on convenience.

Below table contains list of all such expressions in both VB native function as well as using .NET properties and methods. This is not the only way to find this value, there can be some other expressions for each value. But, I have tried to create a list to be start with and later on I will add more.

 

Using Native VB Functions

Using .Net Properties and Functions

First Date of last month

=DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1))

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

Last date of last month

=DateAdd("d", -1, DateSerial(Year(Now()), Month(Now()), 1))

=Today.AddDays(-1.0 * Today.Day)

First date of current month

=DateSerial(Year(Now()), Month(Now()), 1)

=Today.AddDays(1 - Today.Day)

Last date of current month

=DateAdd("d",-1,(DateAdd("m", 1, DateSerial(Year(Now()), Month(Now()), 1))))

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

Yesterday's date 

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

=Today.AddDays(-1)

Tomorrow's date 

=DateAdd("d", 1, Today)

=Today.AddDays(1)

* Monday of current week

=DateAdd("d", 2 - DatePart("w",Today) , Today)

=Today.AddDays(1- Today.DayOfWeek)

* Friday current week

=DateAdd("d", 6 - DatePart("w",Today) , Today)

=Today.AddDays(5- Today.DayOfWeek)

First day of current year

=DateSerial(Year(Now()), 1, 1)

=Today.AddDays(1-  Today.DayOfYear)

Last day of current year

=DateSerial(Year(Now()), 12, 31)

=Today.AddDays(-1 *  Today.DayOfYear).AddYears(1)

First day of current quarter

=DateSerial(Year(Now()), (3*DatePart("q",Now()))-2, 1)

=Today.AddDays(1-  Today.DayOfYear).AddMonths((3 * (((Today.Month-1) \ 3) + 1) ) -3)

Last day of current quarter

=DateAdd("d",-1,DateAdd("q",1,DateSerial(Year(Now()), (3*DatePart("q",Now()))-2, 1)))

=Today.AddDays(1-  Today.DayOfYear).AddMonths((3 * (((Today.Month-1) \ 3) + 1) )).AddDays(-1)

 * Week is considered to start on Sunday, need to change expression if need to change week start date

References:-

.Net Properties: http://msdn.microsoft.com/en-us/library/system.datetime_properties.aspx

.Net Methods:   http://msdn.microsoft.com/en-us/library/system.datetime_methods.aspx

VB functions: http://msdn.microsoft.com/en-us/library/32s6akha(VS.80).aspx

Tags: BRH, SSRS 2008 R2, Date Calculations,


Chintak Chhapia
40 · 5% · 1470
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

2  Comments  

  • This is great - just what I was looking for. Could you please add SSRS expressions for First/Last Day of Previous Quarter. Thanks!!

    commented on Dec 5 2011 10:13AM
    chornung
    1538 · 0% · 13
  • Twice in two days that google has led me to Beyond Relational. Thanks and keep up the good work!

    Phil

    www.sqldbpros.com

    commented on Mar 5 2012 11:37AM
    Phil Steffek
    1921 · 0% · 10

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]