Programming, Reports, SQL Server Reporting Services

How to Get the Current Year in SSRS

SSRS is a flexible platform for quickly and easily deploying reports. A handy set of functions is the inbuilt time handling. In this post I’ll give a quick overview of the options you have available for working with Date and Time values in SSRS, especially when it comes to getting the current year.

To get the year portion of the current date in SSRS you can use the two Common Functions: Year() and Now()
Below is how you would put the Year and Now functions together, for example to populate the default value of a parameter with the current year:
=Year(Now())
You also have functions such as Month() and Day() available, as well as time related functions such as Hour(), Minute() and Second().
If you want to display a human-friendly date, then you can also use the functions MonthName(), and WeekdayName(). All of these are fairly self-explanatory in SSRS, but are useful to know nonetheless.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s