Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Date Expresion Using Reporting Services

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-01-08 : 16:44:23
I am trying to put only the previous month and current year on the report. Here is what I have done so far.
[code]=DateAdd("m", -1, DateSerial(Year(Now()),Month(Now()),Day(NOW())))[\code} * This will give the previous month, day, year. Example: 12/08/2007

--------


=DateAdd("m", -1, DatePart(Year(Now()),Month(Now()))) * This will give me an ERROR in VS2003 Reporting Services.
-------

I need 12/2007 or December 2007.

Thanks for the help,
Osirisa

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-09 : 07:31:19
Try

CStr(Month(Dateadd("m",-1,Now()))) + "/" + Cstr(Year(Dateadd("m",-1,Now())))
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-03-05 : 14:11:43
Thank You Visakh16 :)
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-03-05 : 14:12:22
Thank You I deeply appreciate all your help....:)
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-03-05 : 19:13:47
Let reporting services format your dates, don't try to do it manually with convoluted string expressions!

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

Serge
Starting Member

44 Posts

Posted - 2008-03-06 : 03:51:07
Jeff has got the point! Let SSRS do the formatting for you.
In the mean time "m" stands for minutes and "M" stands for month, so when you do dd-mm-yyyy it will be Day-Minute-Year, so make sure you use M such as dd-MM-yyyy.

Serge
Go to Top of Page
   

- Advertisement -