Skip to main content

Posts

Showing posts with the label ctype

How to get financial year using asp.net code in class

How to get financial year using asp.net code in class Public Function GetFinYear(ByVal Dt1 As String) As String Dim mm, yy As String Dim int_mm, int_yy As Integer Dim dt As String dt = Dt1 ''.ToString("dd/MM/yyyy") Dim frm_dt, to_dt, fin_yr As String mm = dt.Substring(3, 2) yy = dt.Substring(6, 4) int_mm = CType(mm, Integer) int_yy = CType(yy, Integer) If int_mm <= 3 Then to_dt = "31/03/" & yy int_yy = int_yy - 1 frm_dt = "01/04/" & int_yy.ToString() Else frm_dt = "01/04/" & yy int_yy = int_yy + 1 to_dt = "31/03/" & int_yy.ToString() End If fin_yr = frm_dt.Substring(8, 2) + to_dt.Substring(8, 2) Return fin_yr End Function