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 formatting

Author  Topic 

graabein
Starting Member

16 Posts

Posted - 2005-05-20 : 08:30:31
Hi, I'd like to do a couple expression-things with my report.

1) Input parameter "From date" default = "YYYY.MM.DD" - Now() with Month=Now-1 and Day=1
2) Input parameter "To date" default = "YYYY.MM.DD" - Now() with Day=1

The goal is having last month as timespan.

3) Format Globals!ExecutionTime to "dd.mm.yyyy hh:nn" i.e: 20.05.2005 14:33

SQL reporting services uses C# .NET code, am I right? Links to expression formatting pages would be nice!

Thanks,
graabein

graabein
Starting Member

16 Posts

Posted - 2005-05-24 : 02:53:36
I solved it on my own by using report code. Here are the functions (VB.NET):

Public Shared Function FormatDateTime(ByVal Value as Date) As String
FormatDateTime = Format(Value, "dd.MM.yyyy HH:mm")
End Function

Public Shared Function GetFromDate() As String
Dim d as Date
d = DateSerial(Year(Now), Month(Now), 1)
d = DateAdd(DateInterval.Month, -1, d)
GetFromDate = Format(d, "yyyy-MM-dd")
End Function

Public Shared Function GetToDate() As String
Dim d as Date
d = DateSerial(Year(Now), Month(Now), 1)
GetToDate = Format(d, "yyyy-MM-dd")
End Function
Go to Top of Page
   

- Advertisement -