kind of really really easy. But sometimes you get the easy ones. It is almost like SSRS or Microsoft needs a return quarter of date in the date object. But I cannot seem to find one. Anyhoo, I needed to return the current Quarter of the date. Fairly easy to write actually.
Function GetQuarterStr(ByVal theDate As String) As String
Dim theNow As Date
Dim astr As String
theNow = CDate(theDate)
Select Case Month(theNow)
Case 1, 2, 3
astr = "Q1"
Case 4, 5, 6
astr = "Q2"
Case 7, 8, 9
astr = "Q3"
Case Else
astr = "Q4"
End Select
Return astr
End Function
Call it with. Code.GetQuarterStr(thestringdate)
Works wonderfully.
/* http://rnbergren.blogspot.in/2014/04/ssrs-get-quarter-from-date-string.html*/
Function GetQuarterStr(ByVal theDate As String) As String
Dim theNow As Date
Dim astr As String
theNow = CDate(theDate)
Select Case Month(theNow)
Case 1, 2, 3
astr = "Q1"
Case 4, 5, 6
astr = "Q2"
Case 7, 8, 9
astr = "Q3"
Case Else
astr = "Q4"
End Select
Return astr
End Function
Call it with. Code.GetQuarterStr(thestringdate)
Works wonderfully.
/* http://rnbergren.blogspot.in/2014/04/ssrs-get-quarter-from-date-string.html*/
No comments:
Post a Comment